dsh-better-workspace 0.36.7 → 0.36.8
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 +1 -1
- package/package.json +1 -1
- package/src/client.js +18 -10
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-external/dsh-better-workspace",
|
|
3
|
-
"version": "0.36.
|
|
3
|
+
"version": "0.36.8",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"description": "侧边栏工作区树:按官方磁盘目录嵌套(官方 workspace-tree 语义),可选按名称中的 / 分组(默认关闭,设置里开启);新会话页的工作区选择器同树。Workspace tree for the DSH sidebar workspace list, nested by official disk folders with optional \"/\"-name grouping; the New Session workspace picker shows the same tree.",
|
|
6
6
|
"engines": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-better-workspace",
|
|
3
|
-
"version": "0.36.
|
|
3
|
+
"version": "0.36.8",
|
|
4
4
|
"description": "侧边栏工作区树:按官方磁盘目录嵌套(官方 workspace-tree 语义),可选按名称中的 / 分组(默认关闭,设置里开启);新会话页的工作区选择器同树(同一份视图选项即时同步);添加工作区走官方目录流。Workspace tree for the DSH sidebar: disk-path nesting (official workspace-tree semantics), with optional \"/\"-name grouping (off by default), and the same tree in the New Session workspace picker; add-workspace rides the official directory flow.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
package/src/client.js
CHANGED
|
@@ -4041,6 +4041,19 @@ window.__ModuleLoader__.load({
|
|
|
4041
4041
|
return [...blanks, ...pins, ...rest]
|
|
4042
4042
|
}
|
|
4043
4043
|
|
|
4044
|
+
// Global and per-workspace recency share the same ordering contract:
|
|
4045
|
+
// current blank first, then pinned Sessions, then ordinary Sessions.
|
|
4046
|
+
// In flat mode this must run AFTER collecting every workspace and Ungrouped.
|
|
4047
|
+
const orderSessionsByRecency = (rows, currentId) => {
|
|
4048
|
+
const sorted = rows.slice().sort((a, b) => (b.updatedAt - a.updatedAt) || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0))
|
|
4049
|
+
const blank = currentId !== undefined && sorted.find((row) => row.id === currentId && row.blank)
|
|
4050
|
+
if (blank) {
|
|
4051
|
+
const at = sorted.indexOf(blank)
|
|
4052
|
+
if (at > 0) { sorted.splice(at, 1); sorted.unshift(blank) }
|
|
4053
|
+
}
|
|
4054
|
+
return pinnedPartition(sorted)
|
|
4055
|
+
}
|
|
4056
|
+
|
|
4044
4057
|
const sessionTitleOf = (summary, t, rememberedTitle) => {
|
|
4045
4058
|
if (!summary) return ''
|
|
4046
4059
|
if (summary.blank) return t('session.new')
|
|
@@ -8307,15 +8320,7 @@ window.__ModuleLoader__.load({
|
|
|
8307
8320
|
// presentational: nothing is persisted, the host order is untouched,
|
|
8308
8321
|
// and drag-to-reorder anchors are suppressed while active (an order
|
|
8309
8322
|
// the very next render would re-sort is a lie).
|
|
8310
|
-
if (orderBy === 'updated')
|
|
8311
|
-
const sorted = rows.slice().sort((a, b) => (b.updatedAt - a.updatedAt) || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0))
|
|
8312
|
-
const pin = currentId !== undefined && sorted.find((row) => row.id === currentId && row.blank)
|
|
8313
|
-
if (pin) {
|
|
8314
|
-
const at = sorted.indexOf(pin)
|
|
8315
|
-
if (at > 0) { sorted.splice(at, 1); sorted.unshift(pin) }
|
|
8316
|
-
}
|
|
8317
|
-
return pinnedPartition(sorted)
|
|
8318
|
-
}
|
|
8323
|
+
if (orderBy === 'updated') return orderSessionsByRecency(rows, currentId)
|
|
8319
8324
|
const local = typeof insertSessionBefore === 'function' ? [] : sessionOrderOf(workspace.workspaceId)
|
|
8320
8325
|
if (local.length === 0) return pinnedPartition(rows)
|
|
8321
8326
|
const remaining = new Map(rows.map((row) => [row.id, row]))
|
|
@@ -10006,7 +10011,10 @@ window.__ModuleLoader__.load({
|
|
|
10006
10011
|
const rows = []
|
|
10007
10012
|
for (const workspace of items || []) rows.push(...sessionsOf(workspace))
|
|
10008
10013
|
rows.push(...ungrouped)
|
|
10009
|
-
|
|
10014
|
+
// sessionsOf() sorts inside one workspace; flat mode needs one global
|
|
10015
|
+
// recency sort, including the Ungrouped bucket (not per-workspace runs).
|
|
10016
|
+
const ordered = orderBy === 'updated' ? orderSessionsByRecency(rows, currentId) : rows
|
|
10017
|
+
return ordered.map((s) => renderSessionRow({ ...s, leaf: s.title }, 0, undefined))
|
|
10010
10018
|
}
|
|
10011
10019
|
const renderUngroupedBlock = () => {
|
|
10012
10020
|
const rows = []
|