dsh-talk-map 0.1.61 → 0.1.62

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 +53 -23
  2. package/package.json +1 -1
package/client/client.js CHANGED
@@ -461,7 +461,7 @@ var zh = {
461
461
  "digest.empty": "这条对话还没有摘要,先刷新摘要再来看。",
462
462
  "digest.copy": "复制",
463
463
  "digest.close": "关闭",
464
- "global.searchPlaceholder": "b61 · 搜地图上的卡片(标题/正文)",
464
+ "global.searchPlaceholder": "b62 · 搜地图上的卡片(标题/正文)",
465
465
  "global.searchRun": "搜索",
466
466
  "global.searchTitle": "搜索地图",
467
467
  "font.group": "文字大小",
@@ -625,7 +625,7 @@ var en = {
625
625
  "menu.noGroup": "Remove from group (free card)",
626
626
  "menu.open": "Open conversation",
627
627
  "menu.markUnread": "Mark as unread",
628
- "global.searchPlaceholder": "b61 · Search cards on the map",
628
+ "global.searchPlaceholder": "b62 · Search cards on the map",
629
629
  "global.searchRun": "Search",
630
630
  "global.searchTitle": "Search the map",
631
631
  "font.group": "Text size",
@@ -13747,7 +13747,10 @@ function StatusRail(props) {
13747
13747
  const slotsRef = (0, import_react11.useRef)(/* @__PURE__ */ new Map());
13748
13748
  const panelRef = (0, import_react11.useRef)(null);
13749
13749
  const prevTops = (0, import_react11.useRef)(/* @__PURE__ */ new Map());
13750
+ const [shift, setShift] = (0, import_react11.useState)({});
13750
13751
  const orderRef = (0, import_react11.useRef)(order);
13752
+ const hoverRef = (0, import_react11.useRef)(0);
13753
+ const dragIdRef = (0, import_react11.useRef)(null);
13751
13754
  orderRef.current = order;
13752
13755
  const signature = (0, import_react11.useMemo)(
13753
13756
  () => props.entries.map((entry) => `${entry.cardId}:${entry.lamp}:${entry.stamp}`).join("|"),
@@ -13791,28 +13794,39 @@ function StatusRail(props) {
13791
13794
  }, [order, props.entries]);
13792
13795
  (0, import_react11.useLayoutEffect)(() => {
13793
13796
  const next = /* @__PURE__ */ new Map();
13797
+ const deltas = {};
13794
13798
  for (const [cardId, element] of slotsRef.current) {
13795
13799
  const top = element.getBoundingClientRect().top;
13796
13800
  next.set(cardId, top);
13797
13801
  if (drag !== null && drag.cardId === cardId) continue;
13798
13802
  const before = prevTops.current.get(cardId);
13799
13803
  if (before === void 0 || Math.abs(before - top) < 1) continue;
13800
- element.style.transition = "none";
13801
- element.style.transform = `translateY(${before - top}px)`;
13802
- requestAnimationFrame(() => {
13803
- element.style.transition = `transform ${FLIP_MS}ms cubic-bezier(0.22, 0.61, 0.36, 1)`;
13804
- element.style.transform = "";
13805
- });
13804
+ deltas[cardId] = before - top;
13806
13805
  }
13807
13806
  prevTops.current = next;
13807
+ const ids = Object.keys(deltas);
13808
+ if (ids.length === 0) return;
13809
+ setShift(deltas);
13810
+ let inner = 0;
13811
+ const outer = requestAnimationFrame(() => {
13812
+ inner = requestAnimationFrame(() => {
13813
+ setShift({});
13814
+ });
13815
+ });
13816
+ return () => {
13817
+ cancelAnimationFrame(outer);
13818
+ if (inner !== 0) cancelAnimationFrame(inner);
13819
+ };
13808
13820
  }, [order, drag === null]);
13809
13821
  (0, import_react11.useEffect)(() => {
13810
13822
  if (drag === null) return;
13811
13823
  const cardId = drag.cardId;
13824
+ dragIdRef.current = cardId;
13825
+ hoverRef.current = drag.hoverIndex;
13812
13826
  const indexUnder = (pointerY) => {
13813
13827
  let best = 0;
13814
13828
  let bestDistance = Number.POSITIVE_INFINITY;
13815
- const ids = orderRef.current;
13829
+ const ids = orderRef.current.filter((id2) => id2 !== cardId);
13816
13830
  for (let index2 = 0; index2 < ids.length; index2 += 1) {
13817
13831
  const element = slotsRef.current.get(ids[index2]);
13818
13832
  if (element === void 0) continue;
@@ -13826,19 +13840,23 @@ function StatusRail(props) {
13826
13840
  return best;
13827
13841
  };
13828
13842
  const onMove = (event) => {
13829
- setDrag((current) => current === null ? null : { ...current, pointerY: event.clientY });
13830
13843
  const target = indexUnder(event.clientY);
13831
- setOrder((current) => {
13832
- const from = current.indexOf(cardId);
13833
- if (from < 0 || target < 0 || target >= current.length || from === target) return current;
13834
- const next = [...current];
13835
- next.splice(from, 1);
13836
- next.splice(target, 0, cardId);
13837
- return next;
13838
- });
13844
+ hoverRef.current = target;
13845
+ setDrag((current) => current === null ? null : { ...current, pointerY: event.clientY, hoverIndex: target });
13839
13846
  };
13840
13847
  const onUp = () => {
13841
- writeOrder(orderRef.current);
13848
+ const dropped = dragIdRef.current;
13849
+ const at = hoverRef.current;
13850
+ if (dropped !== null) {
13851
+ setOrder((existing) => {
13852
+ const rest = existing.filter((id2) => id2 !== dropped);
13853
+ const index2 = Math.min(Math.max(at, 0), rest.length);
13854
+ const next = [...rest.slice(0, index2), dropped, ...rest.slice(index2)];
13855
+ writeOrder(next);
13856
+ return next;
13857
+ });
13858
+ }
13859
+ dragIdRef.current = null;
13842
13860
  prevTops.current.clear();
13843
13861
  setDrag(null);
13844
13862
  };
@@ -13863,6 +13881,8 @@ function StatusRail(props) {
13863
13881
  event.preventDefault();
13864
13882
  setDrag({
13865
13883
  cardId,
13884
+ hoverIndex: Math.max(0, orderRef.current.indexOf(cardId)),
13885
+ step: rect.height + 10,
13866
13886
  startPointerY: event.clientY,
13867
13887
  baseTop: rect.top - (panelRect?.top ?? 0),
13868
13888
  pointerY: event.clientY,
@@ -13901,7 +13921,15 @@ function StatusRail(props) {
13901
13921
  width: drag.width,
13902
13922
  top: drag.baseTop + (drag.pointerY - drag.startPointerY),
13903
13923
  zIndex: 20
13904
- } : void 0,
13924
+ } : drag !== null ? (() => {
13925
+ const compact = ordered.filter((row) => row.cardId !== drag.cardId);
13926
+ const position = compact.findIndex((row) => row.cardId === entry.cardId);
13927
+ const moved = position >= 0 && position >= drag.hoverIndex ? drag.step : 0;
13928
+ return {
13929
+ transform: `translateY(${moved}px)`,
13930
+ transition: `transform ${FLIP_MS}ms cubic-bezier(0.22, 0.61, 0.36, 1)`
13931
+ };
13932
+ })() : shift[entry.cardId] !== void 0 ? { transform: `translateY(${shift[entry.cardId]}px)`, transition: "none" } : { transition: `transform ${FLIP_MS}ms cubic-bezier(0.22, 0.61, 0.36, 1)` },
13905
13933
  children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
13906
13934
  "div",
13907
13935
  {
@@ -13942,9 +13970,11 @@ function StatusRail(props) {
13942
13970
  title: open ? t("statusRail.close") : t("statusRail.open"),
13943
13971
  onClick: toggle,
13944
13972
  children: [
13945
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("svg", { viewBox: "0 0 12 24", width: "13", height: "26", "aria-hidden": "true", children: [
13946
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: "1.4", y: "1", width: "2", height: "22", rx: "1", fill: "currentColor" }),
13947
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: "8.6", y: "1", width: "2", height: "22", rx: "1", fill: "currentColor" })
13973
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("svg", { viewBox: "0 0 12 28", width: "14", height: "30", "aria-hidden": "true", children: [
13974
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: "1.4", y: "1", width: "2", height: "20", rx: "1", fill: "currentColor" }),
13975
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: "8.6", y: "1", width: "2", height: "20", rx: "1", fill: "currentColor" }),
13976
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("circle", { cx: "2.4", cy: "25", r: "1.5", fill: "currentColor" }),
13977
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("circle", { cx: "9.6", cy: "25", r: "1.5", fill: "currentColor" })
13948
13978
  ] }),
13949
13979
  props.entries.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: talk_map_default["statusRailTabCount"], children: props.entries.length }) : null
13950
13980
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-talk-map",
3
- "version": "0.1.61",
3
+ "version": "0.1.62",
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",