dsh-better-workspace 0.7.1 → 0.7.2

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/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-better-workspace",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "main": "./src/index.js",
5
5
  "description": "侧边栏工作区层级树:名称中的 / 即虚拟分组(web/前端 · web/后端),添加工作区的目录流附所属分组弹窗,重命名即时重排层级,可新建空分组。Hierarchy tree for the DSH sidebar workspace list.",
6
6
  "engines": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-better-workspace",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "DSH web plugin: a hierarchical workspace tree for the sidebar. Workspace titles containing \"/\" group into virtual folders (web/前端 · web/后端); the add-workspace directory flow gains a parent-group popup; renames re-derive the tree; a new-folder button creates empty levels.",
5
5
  "type": "module",
6
6
  "repository": {
package/src/client.js CHANGED
@@ -1312,6 +1312,9 @@ window.__ModuleLoader__.load({
1312
1312
  }
1313
1313
  const dragMatches = (kind) => drag !== null && drag.kind === kind
1314
1314
  const canDragWorkspace = typeof insertWorkspaceBefore === 'function'
1315
+ // Session REORDER needs the host insertSessionBefore action; dragging a
1316
+ // session onto a sub-group row (a pure rename) stays available without it.
1317
+ const canReorderSessions = typeof insertSessionBefore === 'function'
1315
1318
 
1316
1319
  /* --------------------- workspace drag & drop -------------------- */
1317
1320
 
@@ -1443,7 +1446,7 @@ window.__ModuleLoader__.load({
1443
1446
  },
1444
1447
  onDragEnd: () => setDrag(null),
1445
1448
  onDragOver: (event) => {
1446
- if (!dragMatches('session') || drag.source.workspaceId !== workspaceId) return
1449
+ if (!dragMatches('session') || !canReorderSessions || drag.source.workspaceId !== workspaceId) return
1447
1450
  event.preventDefault()
1448
1451
  event.stopPropagation()
1449
1452
  try { event.dataTransfer.dropEffect = 'move' } catch { }
@@ -1453,7 +1456,7 @@ window.__ModuleLoader__.load({
1453
1456
  : (current ? { ...current, over: { kind: 'session', target: session.id, half } } : current))
1454
1457
  },
1455
1458
  onDrop: (event) => {
1456
- if (!dragMatches('session') || drag.source.workspaceId !== workspaceId) return
1459
+ if (!dragMatches('session') || !canReorderSessions || drag.source.workspaceId !== workspaceId) return
1457
1460
  event.preventDefault()
1458
1461
  event.stopPropagation()
1459
1462
  const half = drag.over && drag.over.kind === 'session' && drag.over.target === session.id ? drag.over.half : rowHalf(event)
@@ -1480,6 +1483,7 @@ window.__ModuleLoader__.load({
1480
1483
  const commitSessionDrop = (workspaceId, targetSessionId, half) => {
1481
1484
  const source = drag.source
1482
1485
  setDrag(null)
1486
+ if (!canReorderSessions) return
1483
1487
  if (source.sessionId === targetSessionId) return
1484
1488
  const workspace = (items || []).find(w => w.workspaceId === workspaceId)
1485
1489
  if (!workspace) return
@@ -2029,6 +2033,12 @@ window.__ModuleLoader__.load({
2029
2033
  insertWorkspaceBefore: typeof workspaces.insertBefore === 'function'
2030
2034
  ? (workspaceId, beforeWorkspaceId) => workspaces.insertBefore(workspaceId, beforeWorkspaceId)
2031
2035
  : undefined,
2036
+ // Official contract exposes session reorder through the WORKSPACES
2037
+ // service (see dsh ui-workspace client index.ts); feature-probed so
2038
+ // older hosts degrade to "group-move only" instead of a TypeError.
2039
+ insertSessionBefore: typeof workspaces.insertSessionBefore === 'function'
2040
+ ? (workspaceId, sessionId, beforeSessionId) => workspaces.insertSessionBefore(workspaceId, sessionId, beforeSessionId)
2041
+ : undefined,
2032
2042
  archiveSession: (sessionId) => uiWorkspace.archiveSession(sessionId),
2033
2043
  createWorkspace: (input) => workspaces.create(input),
2034
2044
  pickDirectory: () => uiWorkspace.pickDirectory(),