dsh-talk-map 0.1.60 → 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 +78 -32
  2. package/package.json +1 -1
package/client/client.js CHANGED
@@ -327,10 +327,11 @@ var zh = {
327
327
  "map.toggle": "对话地图",
328
328
  "map.empty": "地图是空的 —— 右键导入工作区或对话;双击空白直接开新对话",
329
329
  "statusRail.title": "队列中的任务",
330
- "confirm.removeGroup.title": "移除这个分组?",
331
- "confirm.removeGroup.body": "只会从地图上移走 {n} 张卡片和这个分组框——会话本身还在侧栏,不会被删除,也不会进回收站。再导入这个工作区就能恢复。",
332
- "confirm.removeGroup.ok": "移除",
330
+ "confirm.removeGroup.title": "删除这个分组?",
331
+ "confirm.removeGroup.body": "分组里的 {n} 个会话会被移入回收站(可在回收站恢复),卡片和分组框同时从地图上移除。仍在运行的会话会先被停止。",
332
+ "confirm.removeGroup.ok": "移入回收站",
333
333
  "confirm.cancel": "取消",
334
+ "toast.workspaceTrashed": "已把 {n} 个会话移入回收站,分组已从地图移除",
334
335
  "statusRail.open": "展开状态栏",
335
336
  "statusRail.close": "收起状态栏",
336
337
  "statusRail.empty": "暂时没有带状态的卡片",
@@ -460,7 +461,7 @@ var zh = {
460
461
  "digest.empty": "这条对话还没有摘要,先刷新摘要再来看。",
461
462
  "digest.copy": "复制",
462
463
  "digest.close": "关闭",
463
- "global.searchPlaceholder": "b60 · 搜地图上的卡片(标题/正文)",
464
+ "global.searchPlaceholder": "b62 · 搜地图上的卡片(标题/正文)",
464
465
  "global.searchRun": "搜索",
465
466
  "global.searchTitle": "搜索地图",
466
467
  "font.group": "文字大小",
@@ -488,7 +489,7 @@ var zh = {
488
489
  "lang.zh": "中文",
489
490
  "lang.en": "English",
490
491
  "menu.syncGroup": "同步该工作区的新会话",
491
- "menu.removeGroup": "移除分组(连同卡片)"
492
+ "menu.removeGroup": "删除分组(连同会话)"
492
493
  };
493
494
  var en = {
494
495
  "map.title": "Talk Map ·v2",
@@ -497,10 +498,11 @@ var en = {
497
498
  "map.toggle": "Talk Map",
498
499
  "map.empty": "The map is empty — right-click to import a workspace or conversation; double-click to start a chat",
499
500
  "statusRail.title": "Tasks in the queue",
500
- "confirm.removeGroup.title": "Remove this group?",
501
- "confirm.removeGroup.body": "This only takes {n} cards and the group frame off the map — the conversations stay in the sidebar, nothing is deleted and nothing goes to the recycle bin. Re-importing the workspace brings it back.",
502
- "confirm.removeGroup.ok": "Remove",
501
+ "confirm.removeGroup.title": "Delete this group?",
502
+ "confirm.removeGroup.body": "Its {n} conversations go to the recycle bin (restorable from there) and the cards and frame leave the map. Anything still running is stopped first.",
503
+ "confirm.removeGroup.ok": "Move to recycle bin",
503
504
  "confirm.cancel": "Cancel",
505
+ "toast.workspaceTrashed": "Moved {n} conversations to the recycle bin; the group is off the map",
504
506
  "statusRail.open": "Open the status rail",
505
507
  "statusRail.close": "Close the status rail",
506
508
  "statusRail.empty": "No card carries a status right now",
@@ -623,7 +625,7 @@ var en = {
623
625
  "menu.noGroup": "Remove from group (free card)",
624
626
  "menu.open": "Open conversation",
625
627
  "menu.markUnread": "Mark as unread",
626
- "global.searchPlaceholder": "b60 · Search cards on the map",
628
+ "global.searchPlaceholder": "b62 · Search cards on the map",
627
629
  "global.searchRun": "Search",
628
630
  "global.searchTitle": "Search the map",
629
631
  "font.group": "Text size",
@@ -651,7 +653,7 @@ var en = {
651
653
  "lang.zh": "中文",
652
654
  "lang.en": "English",
653
655
  "menu.syncGroup": "Sync new sessions of this workspace",
654
- "menu.removeGroup": "Remove group (with its cards)"
656
+ "menu.removeGroup": "Delete group (with its conversations)"
655
657
  };
656
658
  var preference = "auto";
657
659
  var localeListeners = /* @__PURE__ */ new Set();
@@ -13745,7 +13747,10 @@ function StatusRail(props) {
13745
13747
  const slotsRef = (0, import_react11.useRef)(/* @__PURE__ */ new Map());
13746
13748
  const panelRef = (0, import_react11.useRef)(null);
13747
13749
  const prevTops = (0, import_react11.useRef)(/* @__PURE__ */ new Map());
13750
+ const [shift, setShift] = (0, import_react11.useState)({});
13748
13751
  const orderRef = (0, import_react11.useRef)(order);
13752
+ const hoverRef = (0, import_react11.useRef)(0);
13753
+ const dragIdRef = (0, import_react11.useRef)(null);
13749
13754
  orderRef.current = order;
13750
13755
  const signature = (0, import_react11.useMemo)(
13751
13756
  () => props.entries.map((entry) => `${entry.cardId}:${entry.lamp}:${entry.stamp}`).join("|"),
@@ -13789,28 +13794,39 @@ function StatusRail(props) {
13789
13794
  }, [order, props.entries]);
13790
13795
  (0, import_react11.useLayoutEffect)(() => {
13791
13796
  const next = /* @__PURE__ */ new Map();
13797
+ const deltas = {};
13792
13798
  for (const [cardId, element] of slotsRef.current) {
13793
13799
  const top = element.getBoundingClientRect().top;
13794
13800
  next.set(cardId, top);
13795
13801
  if (drag !== null && drag.cardId === cardId) continue;
13796
13802
  const before = prevTops.current.get(cardId);
13797
13803
  if (before === void 0 || Math.abs(before - top) < 1) continue;
13798
- element.style.transition = "none";
13799
- element.style.transform = `translateY(${before - top}px)`;
13800
- requestAnimationFrame(() => {
13801
- element.style.transition = `transform ${FLIP_MS}ms cubic-bezier(0.22, 0.61, 0.36, 1)`;
13802
- element.style.transform = "";
13803
- });
13804
+ deltas[cardId] = before - top;
13804
13805
  }
13805
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
+ };
13806
13820
  }, [order, drag === null]);
13807
13821
  (0, import_react11.useEffect)(() => {
13808
13822
  if (drag === null) return;
13809
13823
  const cardId = drag.cardId;
13824
+ dragIdRef.current = cardId;
13825
+ hoverRef.current = drag.hoverIndex;
13810
13826
  const indexUnder = (pointerY) => {
13811
13827
  let best = 0;
13812
13828
  let bestDistance = Number.POSITIVE_INFINITY;
13813
- const ids = orderRef.current;
13829
+ const ids = orderRef.current.filter((id2) => id2 !== cardId);
13814
13830
  for (let index2 = 0; index2 < ids.length; index2 += 1) {
13815
13831
  const element = slotsRef.current.get(ids[index2]);
13816
13832
  if (element === void 0) continue;
@@ -13824,19 +13840,23 @@ function StatusRail(props) {
13824
13840
  return best;
13825
13841
  };
13826
13842
  const onMove = (event) => {
13827
- setDrag((current) => current === null ? null : { ...current, pointerY: event.clientY });
13828
13843
  const target = indexUnder(event.clientY);
13829
- setOrder((current) => {
13830
- const from = current.indexOf(cardId);
13831
- if (from < 0 || target < 0 || target >= current.length || from === target) return current;
13832
- const next = [...current];
13833
- next.splice(from, 1);
13834
- next.splice(target, 0, cardId);
13835
- return next;
13836
- });
13844
+ hoverRef.current = target;
13845
+ setDrag((current) => current === null ? null : { ...current, pointerY: event.clientY, hoverIndex: target });
13837
13846
  };
13838
13847
  const onUp = () => {
13839
- 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;
13840
13860
  prevTops.current.clear();
13841
13861
  setDrag(null);
13842
13862
  };
@@ -13861,6 +13881,8 @@ function StatusRail(props) {
13861
13881
  event.preventDefault();
13862
13882
  setDrag({
13863
13883
  cardId,
13884
+ hoverIndex: Math.max(0, orderRef.current.indexOf(cardId)),
13885
+ step: rect.height + 10,
13864
13886
  startPointerY: event.clientY,
13865
13887
  baseTop: rect.top - (panelRect?.top ?? 0),
13866
13888
  pointerY: event.clientY,
@@ -13899,7 +13921,15 @@ function StatusRail(props) {
13899
13921
  width: drag.width,
13900
13922
  top: drag.baseTop + (drag.pointerY - drag.startPointerY),
13901
13923
  zIndex: 20
13902
- } : 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)` },
13903
13933
  children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
13904
13934
  "div",
13905
13935
  {
@@ -13940,9 +13970,11 @@ function StatusRail(props) {
13940
13970
  title: open ? t("statusRail.close") : t("statusRail.open"),
13941
13971
  onClick: toggle,
13942
13972
  children: [
13943
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("svg", { viewBox: "0 0 12 24", width: "13", height: "26", "aria-hidden": "true", children: [
13944
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: "1.4", y: "1", width: "2", height: "22", rx: "1", fill: "currentColor" }),
13945
- /* @__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" })
13946
13978
  ] }),
13947
13979
  props.entries.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: talk_map_default["statusRailTabCount"], children: props.entries.length }) : null
13948
13980
  ]
@@ -15400,6 +15432,20 @@ function CanvasInner(props) {
15400
15432
  });
15401
15433
  canvas.addCards(added);
15402
15434
  };
15435
+ const deleteWorkspace = async (groupId) => {
15436
+ const sessionIds = (membersByGroup.get(groupId) ?? []).map((cardId) => visibleCards[cardId]?.sessionId).filter((sessionId) => sessionId !== void 0);
15437
+ try {
15438
+ if (sessionIds.length > 0) {
15439
+ await trashSessions(sessionIds, () => {
15440
+ showToast(t("toast.stopping"));
15441
+ });
15442
+ }
15443
+ removeGroup(groupId);
15444
+ showToast(t("toast.workspaceTrashed", { n: String(sessionIds.length) }));
15445
+ } catch (error) {
15446
+ showToast(String(error?.message ?? error));
15447
+ }
15448
+ };
15403
15449
  const removeGroup = (groupId) => {
15404
15450
  for (const cardId of membersByGroup.get(groupId) ?? []) canvas.removeCard(cardId);
15405
15451
  const framesNext = { ...wsFrames };
@@ -15844,7 +15890,7 @@ function CanvasInner(props) {
15844
15890
  type: "button",
15845
15891
  className: talk_map_default["dangerOk"],
15846
15892
  onClick: () => {
15847
- removeGroup(confirmRemove.groupId);
15893
+ void deleteWorkspace(confirmRemove.groupId);
15848
15894
  setConfirmRemove(null);
15849
15895
  },
15850
15896
  children: t("confirm.removeGroup.ok")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-talk-map",
3
- "version": "0.1.60",
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",