dsh-workspace-grid 0.0.0-stage → 1.0.0
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/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +40 -2
- package/README.zh.md +44 -0
- package/cordis.patch.yml +9 -0
- package/docs/DETAIL.md +1 -0
- package/docs/DETAIL.zh.md +1 -0
- package/docs/preview.svg +73 -0
- package/icon.svg +11 -0
- package/lib/client.js +324 -0
- package/lib/index.js +10 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +49 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
- Packaged as an installable bundle (`dsh.bundle.patch`) with title, description, detail image and icon, so it appears in **Plugins** and can be enabled, disabled or removed there.
|
|
6
|
+
- Same behavior as the 0.1.0 local prototype: a **Grid (3 columns)** item in the workspace view options menu, tile layout for workspaces without sessions, accent highlight for the opened workspace and the selected session, and the sidebar opened at its 420px maximum on startup.
|
|
7
|
+
- The menu label follows the browser language (Chinese or English).
|
|
8
|
+
- The injected menu item now also updates its accessible label and, when the row is checkable, `aria-checked`.
|
|
9
|
+
- The toggle still reads and writes `dsh.workspaceGrid.enabled`, so the existing state is kept.
|
|
10
|
+
|
|
11
|
+
## 0.1.0
|
|
12
|
+
|
|
13
|
+
- Local prototype mounted from `~/.dsh/local-plugins/workspace-grid` by a hand-written patch line.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 John Xiao
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-workspace-grid
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A DeepSeek Harness plugin that shows the sidebar's workspace list as a three-column tile grid.
|
|
4
|
+
The switch is one item in the workspace **view options** menu, next to **Group by** — no new icon or button.
|
|
5
|
+
|
|
6
|
+
## What it does
|
|
7
|
+
|
|
8
|
+
- **Off (default)**: exactly the stock one-column list.
|
|
9
|
+
- **Grid (3 columns)**: a workspace without sessions becomes a compact tile — folder icon on top, name centered and clamped to three lines. A workspace that holds sessions, or child workspaces under **Group by → Workspace tree**, keeps a full row, so session titles stay as wide as before.
|
|
10
|
+
- **The opened workspace is highlighted**: an expanded folder (`aria-expanded="true"`) gets a tinted background, an accent border and accent-colored icon and name, so opened and closed are distinguishable at a glance. Collapsing restores the plain tile.
|
|
11
|
+
- **The selected session uses the same accent**: the current session row gets the same treatment, so workspace → session → conversation reads as one visual trail.
|
|
12
|
+
- **Layout only**: clicking, drag-to-sort, the context menu, hover cards (full name and path) and new-session entries are the stock elements.
|
|
13
|
+
- **Sidebar opens at its maximum width (420px)**: the layout does not persist the sidebar width, so it returns to 280px on every start. On startup the plugin drives the frame's own drag handle to the layout's contract maximum. You can still drag it narrower afterwards; the plugin only sets it once per load.
|
|
14
|
+
- The switch state lives in browser `localStorage` (`dsh.workspaceGrid.enabled`) and survives restarts.
|
|
15
|
+
- Colors are theme tokens: tiles and highlights follow light and dark mode.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
Install this folder as a bundle:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
plugins → Add plugin → the absolute path of this directory
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
or, from an agent: `plugin_manager` `install_bundle` with the package directory as `target`.
|
|
26
|
+
The bundle patch inserts the `workspace-grid` row, so the plugin appears in **Plugins** with its own title, description and icon.
|
|
27
|
+
|
|
28
|
+
## Turn it off
|
|
29
|
+
|
|
30
|
+
- View only: open the workspace view options menu and click **Grid (3 columns)** again; the check disappears and the list returns to one column.
|
|
31
|
+
- Plugin level: disable the bundle in **Plugins** (or remove it). Nothing in the workspace is modified.
|
|
32
|
+
|
|
33
|
+
## Known limits
|
|
34
|
+
|
|
35
|
+
- The plugin matches the host's CSS-module class suffixes and a few `aria` attributes. If a DSH upgrade renames them, the rules stop applying and the list falls back to one column; nothing breaks.
|
|
36
|
+
- Keyboard arrow navigation covers the stock menu items; the injected item is used with mouse or touch.
|
|
37
|
+
- With **Group by → Single list** there is no workspace grouping, so the grid has nothing to lay out (the switch state is kept).
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
MIT. See `LICENSE`.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# dsh-workspace-grid
|
|
2
|
+
|
|
3
|
+
一个 DeepSeek Harness 插件:把侧栏的「工作区」列表排成三列瓦片。
|
|
4
|
+
开关就是工作区**视图选项**菜单里的一项,和「分组方式」并排,不新增任何图标或按钮。
|
|
5
|
+
|
|
6
|
+
## 效果
|
|
7
|
+
|
|
8
|
+
- **关闭(默认)**:和原版完全一样,一列。
|
|
9
|
+
- **开启「九宫格(3 列)」**:没有会话的工作区排成 3 列瓦片(文件夹图标在上、名称居中最多 3 行);
|
|
10
|
+
有会话、或「按工作区树」下带子工作区的工作区仍占满整行,会话列表宽度不变,照旧可读。
|
|
11
|
+
- **点开的工作区会高亮**:展开(`aria-expanded="true"`)的文件夹是浅蓝底 + 强调色描边 + 强调色图标/名称,
|
|
12
|
+
一眼能分清「点开了」和「没点开」;收起即恢复。
|
|
13
|
+
- **选中的会话也是强调色**:当前打开的会话行使用同一套强调色,工作区 → 会话 → 对话连成一条视觉线索。
|
|
14
|
+
- **只改排布**:点击、拖拽排序、右键菜单、悬停卡片(完整名称 + 路径)、新建会话全部沿用官方元素。
|
|
15
|
+
- **左侧栏启动时开到最大宽度 420px**:布局本身不持久化侧栏宽度,每次启动都会回到 280px;
|
|
16
|
+
本插件在启动时通过框架自己的拖拽手柄把它拉到契约上限。之后仍然可以正常拖窄 —— 每次加载只设一次。
|
|
17
|
+
- 开关状态存在浏览器 localStorage(`dsh.workspaceGrid.enabled`),重启后保持。
|
|
18
|
+
- 配色不写死:瓦片底色与高亮色跟随浅色/深色主题(`data-ds-dark-theme`)。
|
|
19
|
+
|
|
20
|
+
## 安装
|
|
21
|
+
|
|
22
|
+
把这个目录作为 bundle 安装:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
插件 → 添加插件 → 本目录的绝对路径
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
或在会话里让 agent 用 `plugin_manager` 的 `install_bundle`,`target` 填本目录。
|
|
29
|
+
bundle 的补丁会插入 `workspace-grid` 这一行,因此它会在**插件**列表里带着自己的名称、说明和图标出现。
|
|
30
|
+
|
|
31
|
+
## 关闭
|
|
32
|
+
|
|
33
|
+
- 只关视图:在「视图选项」菜单里再点一次「九宫格(3 列)」,勾消失即恢复一列。
|
|
34
|
+
- 插件层面:在**插件**里停用(或移除)本 bundle。不会改动任何工作区文件。
|
|
35
|
+
|
|
36
|
+
## 已知限制
|
|
37
|
+
|
|
38
|
+
- 插件靠官方 CSS Module 的类名后缀和几个 `aria` 属性定位元素。DSH 升级若改名,规则会失效并退回一列,不会破坏原布局。
|
|
39
|
+
- 菜单项的键盘上下切换只覆盖官方菜单项,注入的这一项用鼠标/触屏点击。
|
|
40
|
+
- 「分组方式 → 单列表」时没有工作区分组,九宫格不生效(开关状态仍保留)。
|
|
41
|
+
|
|
42
|
+
## 许可
|
|
43
|
+
|
|
44
|
+
MIT,见 `LICENSE`。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Bundle patch of dsh-workspace-grid.
|
|
2
|
+
#
|
|
3
|
+
# The row id stays `workspace-grid` on purpose: it is the same id the earlier
|
|
4
|
+
# hand-wired install used, so an existing toggle state keeps working after the
|
|
5
|
+
# switch to a bundle.
|
|
6
|
+
- insert:
|
|
7
|
+
- id: workspace-grid
|
|
8
|
+
# Must equal package.json `name`: the loader imports the package by this name.
|
|
9
|
+
name: dsh-workspace-grid
|
package/docs/DETAIL.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+

|
|
@@ -0,0 +1 @@
|
|
|
1
|
+

|
package/docs/preview.svg
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="640" height="300" viewBox="0 0 640 300" role="img" aria-label="A sidebar workspace list arranged as three columns of tiles, with the view options menu open and the grid item checked">
|
|
2
|
+
<rect x="8" y="8" width="624" height="284" rx="18" fill="#EEF3F9"/>
|
|
3
|
+
<rect x="36" y="30" width="260" height="240" rx="14" fill="#FFFFFF" stroke="#D9E2ED" stroke-width="2"/>
|
|
4
|
+
<rect x="56" y="50" width="92" height="9" rx="4.5" fill="#B6C3D2"/>
|
|
5
|
+
<rect x="250" y="46" width="26" height="16" rx="4" fill="#E6ECF4"/>
|
|
6
|
+
<circle cx="257" cy="54" r="1.3" fill="#8A97A6"/>
|
|
7
|
+
<circle cx="263" cy="54" r="1.3" fill="#8A97A6"/>
|
|
8
|
+
<circle cx="269" cy="54" r="1.3" fill="#8A97A6"/>
|
|
9
|
+
<rect x="56" y="76" width="64" height="52" rx="8" fill="#F2F6FB" stroke="#E3EAF3" stroke-width="1.5"/>
|
|
10
|
+
<g fill="#93A2B5">
|
|
11
|
+
<rect x="79" y="89" width="18" height="10" rx="2"/>
|
|
12
|
+
<rect x="79" y="86" width="7" height="4" rx="1"/>
|
|
13
|
+
</g>
|
|
14
|
+
<rect x="68" y="107" width="40" height="6" rx="3" fill="#C6D2E0"/>
|
|
15
|
+
<rect x="74" y="117" width="28" height="6" rx="3" fill="#D7E1EC"/>
|
|
16
|
+
<rect x="128" y="76" width="64" height="52" rx="8" fill="#E8EDFF" stroke="#AFC0FF" stroke-width="2"/>
|
|
17
|
+
<g fill="#4D6BFE">
|
|
18
|
+
<rect x="151" y="89" width="18" height="10" rx="2"/>
|
|
19
|
+
<rect x="151" y="86" width="7" height="4" rx="1"/>
|
|
20
|
+
</g>
|
|
21
|
+
<rect x="140" y="107" width="40" height="6" rx="3" fill="#7C8CFF"/>
|
|
22
|
+
<rect x="146" y="117" width="28" height="6" rx="3" fill="#AEB9FF"/>
|
|
23
|
+
<rect x="200" y="76" width="64" height="52" rx="8" fill="#F2F6FB" stroke="#E3EAF3" stroke-width="1.5"/>
|
|
24
|
+
<g fill="#93A2B5">
|
|
25
|
+
<rect x="223" y="89" width="18" height="10" rx="2"/>
|
|
26
|
+
<rect x="223" y="86" width="7" height="4" rx="1"/>
|
|
27
|
+
</g>
|
|
28
|
+
<rect x="212" y="107" width="40" height="6" rx="3" fill="#C6D2E0"/>
|
|
29
|
+
<rect x="218" y="117" width="28" height="6" rx="3" fill="#D7E1EC"/>
|
|
30
|
+
<rect x="56" y="136" width="64" height="52" rx="8" fill="#F2F6FB" stroke="#E3EAF3" stroke-width="1.5"/>
|
|
31
|
+
<g fill="#93A2B5">
|
|
32
|
+
<rect x="79" y="149" width="18" height="10" rx="2"/>
|
|
33
|
+
<rect x="79" y="146" width="7" height="4" rx="1"/>
|
|
34
|
+
</g>
|
|
35
|
+
<rect x="68" y="167" width="40" height="6" rx="3" fill="#C6D2E0"/>
|
|
36
|
+
<rect x="74" y="177" width="28" height="6" rx="3" fill="#D7E1EC"/>
|
|
37
|
+
<rect x="128" y="136" width="64" height="52" rx="8" fill="#F2F6FB" stroke="#E3EAF3" stroke-width="1.5"/>
|
|
38
|
+
<g fill="#93A2B5">
|
|
39
|
+
<rect x="151" y="149" width="18" height="10" rx="2"/>
|
|
40
|
+
<rect x="151" y="146" width="7" height="4" rx="1"/>
|
|
41
|
+
</g>
|
|
42
|
+
<rect x="140" y="167" width="40" height="6" rx="3" fill="#C6D2E0"/>
|
|
43
|
+
<rect x="146" y="177" width="28" height="6" rx="3" fill="#D7E1EC"/>
|
|
44
|
+
<rect x="200" y="136" width="64" height="52" rx="8" fill="#F2F6FB" stroke="#E3EAF3" stroke-width="1.5"/>
|
|
45
|
+
<g fill="#93A2B5">
|
|
46
|
+
<rect x="223" y="149" width="18" height="10" rx="2"/>
|
|
47
|
+
<rect x="223" y="146" width="7" height="4" rx="1"/>
|
|
48
|
+
</g>
|
|
49
|
+
<rect x="212" y="167" width="40" height="6" rx="3" fill="#C6D2E0"/>
|
|
50
|
+
<rect x="218" y="177" width="28" height="6" rx="3" fill="#D7E1EC"/>
|
|
51
|
+
<rect x="56" y="196" width="208" height="52" rx="8" fill="#F7FAFD" stroke="#E3EAF3" stroke-width="1.5"/>
|
|
52
|
+
<rect x="70" y="208" width="80" height="7" rx="3.5" fill="#9AA6B5"/>
|
|
53
|
+
<circle cx="75" cy="228" r="2.6" fill="#4D6BFE"/>
|
|
54
|
+
<rect x="84" y="224" width="130" height="7" rx="3.5" fill="#CBD6E3"/>
|
|
55
|
+
<circle cx="75" cy="240" r="2.6" fill="#C2CDDB"/>
|
|
56
|
+
<rect x="84" y="236" width="96" height="7" rx="3.5" fill="#D7E1EC"/>
|
|
57
|
+
<rect x="316" y="52" width="248" height="156" rx="12" fill="#FFFFFF" stroke="#D9E2ED" stroke-width="2"/>
|
|
58
|
+
<rect x="336" y="70" width="64" height="7" rx="3.5" fill="#A9B6C6"/>
|
|
59
|
+
<rect x="336" y="88" width="12" height="12" rx="3" fill="#B6C3D2"/>
|
|
60
|
+
<rect x="356" y="91" width="100" height="7" rx="3.5" fill="#C6D2E0"/>
|
|
61
|
+
<rect x="336" y="114" width="12" height="12" rx="3" fill="#B6C3D2"/>
|
|
62
|
+
<rect x="356" y="117" width="84" height="7" rx="3.5" fill="#C6D2E0"/>
|
|
63
|
+
<rect x="336" y="140" width="12" height="12" rx="3" fill="#B6C3D2"/>
|
|
64
|
+
<rect x="356" y="143" width="72" height="7" rx="3.5" fill="#C6D2E0"/>
|
|
65
|
+
<g fill="#4D6BFE">
|
|
66
|
+
<rect x="336" y="168" width="4.4" height="4.4" rx="1.2"/>
|
|
67
|
+
<rect x="342.6" y="168" width="4.4" height="4.4" rx="1.2"/>
|
|
68
|
+
<rect x="336" y="174.6" width="4.4" height="4.4" rx="1.2"/>
|
|
69
|
+
<rect x="342.6" y="174.6" width="4.4" height="4.4" rx="1.2"/>
|
|
70
|
+
</g>
|
|
71
|
+
<rect x="356" y="170" width="96" height="8" rx="4" fill="#7C8CFF"/>
|
|
72
|
+
<path d="M524 175 L530 181 L542 167" fill="none" stroke="#4D6BFE" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
|
|
73
|
+
</svg>
|
package/icon.svg
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg width="36" height="36" viewBox="0 0 36 36" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Workspace grid">
|
|
2
|
+
<rect x="4.3" y="4.3" width="7.2" height="7.2" rx="1.8" fill="#9AA6B5"/>
|
|
3
|
+
<rect x="4.3" y="14.4" width="7.2" height="7.2" rx="1.8" fill="#9AA6B5"/>
|
|
4
|
+
<rect x="4.3" y="24.5" width="7.2" height="7.2" rx="1.8" fill="#9AA6B5"/>
|
|
5
|
+
<rect x="14.4" y="24.5" width="7.2" height="7.2" rx="1.8" fill="#9AA6B5"/>
|
|
6
|
+
<rect x="24.5" y="24.5" width="7.2" height="7.2" rx="1.8" fill="#9AA6B5"/>
|
|
7
|
+
<rect x="24.5" y="14.4" width="7.2" height="7.2" rx="1.8" fill="#9AA6B5"/>
|
|
8
|
+
<rect x="14.4" y="14.4" width="7.2" height="7.2" rx="1.8" fill="#4D6BFE"/>
|
|
9
|
+
<rect x="24.5" y="4.3" width="7.2" height="7.2" rx="1.8" fill="#9AA6B5"/>
|
|
10
|
+
<rect x="14.4" y="4.3" width="7.2" height="7.2" rx="1.8" fill="#9AA6B5" opacity="0.55"/>
|
|
11
|
+
</svg>
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser half of dsh-workspace-grid.
|
|
3
|
+
*
|
|
4
|
+
* Adds one entry to the workspace "view options" menu and, while it is on,
|
|
5
|
+
* lays the workspace list out as a three-column tile grid. Everything is
|
|
6
|
+
* derived from the host's own DOM nodes and CSS-module class suffixes, so the
|
|
7
|
+
* plugin never depends on build hashes. When a selector stops matching, the
|
|
8
|
+
* view simply stays one column instead of breaking the sidebar.
|
|
9
|
+
*/
|
|
10
|
+
window.__ModuleLoader__.load({
|
|
11
|
+
id: "dsh-workspace-grid",
|
|
12
|
+
factory: (require) => {
|
|
13
|
+
var module = { exports: {} };
|
|
14
|
+
var exports = module.exports;
|
|
15
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
16
|
+
|
|
17
|
+
var STORE_KEY = "dsh.workspaceGrid.enabled";
|
|
18
|
+
var ATTR = "data-dsh-workspace-grid";
|
|
19
|
+
|
|
20
|
+
function prefersZh() {
|
|
21
|
+
try {
|
|
22
|
+
var tags = navigator.languages && navigator.languages.length ? navigator.languages : [navigator.language || ""];
|
|
23
|
+
for (var i = 0; i < tags.length; i++) if (/^zh/i.test(String(tags[i] || ""))) return true;
|
|
24
|
+
} catch (e) {}
|
|
25
|
+
try {
|
|
26
|
+
return /^zh/i.test(document.documentElement.lang || "");
|
|
27
|
+
} catch (e) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var LABEL = prefersZh() ? "九宫格(3 列)" : "Grid (3 columns)";
|
|
33
|
+
var GROUP_LABEL = /分组方式|Group by/i;
|
|
34
|
+
var SIDEBAR_MAX = 420;
|
|
35
|
+
var GRID_ICON =
|
|
36
|
+
'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" stroke="currentColor" stroke-width="1"><rect x="2" y="2" width="4.2" height="4.2" rx="1"></rect><rect x="9.8" y="2" width="4.2" height="4.2" rx="1"></rect><rect x="2" y="9.8" width="4.2" height="4.2" rx="1"></rect><rect x="9.8" y="9.8" width="4.2" height="4.2" rx="1"></rect></svg>';
|
|
37
|
+
|
|
38
|
+
var ACCENT = "var(--dsw-alias-state-business-primary,#4d6bfe)";
|
|
39
|
+
var SCOPE = 'html[data-dsh-workspace-grid="on"] [data-slot="sidebar.workspaces"] [role="tree"]';
|
|
40
|
+
var TILE = SCOPE + ' > [class*="groupSection"]:not(:has([class*="sessionRow"])):not(:has([class*="groupSection"]))';
|
|
41
|
+
|
|
42
|
+
var CSS = [
|
|
43
|
+
/* the workspace list becomes a three-column grid */
|
|
44
|
+
SCOPE + ':has(> [class*="groupSection"]){display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:3px 4px;align-content:start}',
|
|
45
|
+
SCOPE + ' > [class*="groupSection"]{min-width:0;margin-top:0}',
|
|
46
|
+
SCOPE + ' > [class*="groupSection"] > span{display:block;min-width:0}',
|
|
47
|
+
/* a workspace that holds sessions (or child workspaces) keeps a full row */
|
|
48
|
+
SCOPE + ' > [class*="groupSection"]:has([class*="sessionRow"]),' +
|
|
49
|
+
SCOPE + ' > [class*="groupSection"]:has([class*="sessionOverflowButton"]),' +
|
|
50
|
+
SCOPE + ' > [class*="groupSection"]:has([class*="groupSection"]){grid-column:1/-1}',
|
|
51
|
+
/* an empty workspace is a compact tile */
|
|
52
|
+
TILE + ' [class*="projectRow"]{box-sizing:border-box;height:auto;min-height:60px;flex-direction:column;justify-content:center;align-items:center;gap:4px;padding:8px 4px;padding-inline-start:4px;text-align:center;background:rgba(28,29,33,.035);border-radius:8px}',
|
|
53
|
+
TILE + ' [class*="projectRow"]:hover{background:rgba(28,29,33,.075)}',
|
|
54
|
+
'body[data-ds-dark-theme] ' + TILE + ' [class*="projectRow"]{background:rgba(255,255,255,.06)}',
|
|
55
|
+
'body[data-ds-dark-theme] ' + TILE + ' [class*="projectRow"]:hover{background:rgba(255,255,255,.12)}',
|
|
56
|
+
/* inside a tile: no chevron, no hover action buttons */
|
|
57
|
+
TILE + ' [class*="projectRow"] [class*="chevron"]{display:none!important}',
|
|
58
|
+
TILE + ' [class*="projectRow"] [class*="rowActions"]{display:none!important}',
|
|
59
|
+
TILE + ' [class*="projectRow"] [class*="folder"]{display:inline-flex!important;width:100%;height:18px;justify-content:center}',
|
|
60
|
+
TILE + ' [class*="projectRow"] [class*="projectText"]{width:100%;flex:none;align-items:center}',
|
|
61
|
+
TILE + ' [class*="projectRow"] [class*="projectText"] [class*="title"]{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;white-space:normal;overflow:hidden;text-overflow:clip;overflow-wrap:break-word;word-break:keep-all;width:100%;font-size:11px;line-height:13px;text-align:center}',
|
|
62
|
+
/* an opened workspace is highlighted, so open and closed differ at a glance */
|
|
63
|
+
SCOPE + ' [class*="projectRow"][aria-expanded="true"]{background:color-mix(in srgb,' + ACCENT + ' 14%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,' + ACCENT + ' 42%,transparent);border-radius:8px}',
|
|
64
|
+
SCOPE + ' [class*="projectRow"][aria-expanded="true"] [class*="folder"],' + SCOPE + ' [class*="projectRow"][aria-expanded="true"] [class*="title"]{color:' + ACCENT + '}',
|
|
65
|
+
SCOPE + ' [class*="projectRow"][aria-expanded="true"] [class*="title"]{font-weight:500}',
|
|
66
|
+
/* the selected session gets the same accent treatment */
|
|
67
|
+
SCOPE + ' [class*="sessionRow"][class*="selected"]{background:color-mix(in srgb,' + ACCENT + ' 12%,transparent);border-radius:8px}',
|
|
68
|
+
SCOPE + ' [class*="sessionRow"][class*="selected"] [class*="title"]{color:' + ACCENT + ';font-weight:500}',
|
|
69
|
+
].join("\n");
|
|
70
|
+
|
|
71
|
+
// ---------------------------------------------------------------
|
|
72
|
+
// persisted state
|
|
73
|
+
// ---------------------------------------------------------------
|
|
74
|
+
function readEnabled() {
|
|
75
|
+
try {
|
|
76
|
+
return localStorage.getItem(STORE_KEY) === "1";
|
|
77
|
+
} catch (e) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function writeEnabled(value) {
|
|
83
|
+
try {
|
|
84
|
+
localStorage.setItem(STORE_KEY, value ? "1" : "0");
|
|
85
|
+
} catch (e) {}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var enabled = readEnabled();
|
|
89
|
+
var styleEl = null;
|
|
90
|
+
|
|
91
|
+
function applyState() {
|
|
92
|
+
var root = document.documentElement;
|
|
93
|
+
if (enabled) root.setAttribute(ATTR, "on");
|
|
94
|
+
else root.removeAttribute(ATTR);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function ensureStyle(doc) {
|
|
98
|
+
if (styleEl && styleEl.isConnected) return styleEl;
|
|
99
|
+
styleEl = doc.createElement("style");
|
|
100
|
+
styleEl.dataset.dshWorkspaceGrid = "";
|
|
101
|
+
styleEl.textContent = CSS;
|
|
102
|
+
doc.head.appendChild(styleEl);
|
|
103
|
+
return styleEl;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function setEnabled(value) {
|
|
107
|
+
enabled = value;
|
|
108
|
+
writeEnabled(value);
|
|
109
|
+
applyState();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ---------------------------------------------------------------
|
|
113
|
+
// sidebar width: open the frame at the contract's maximum width
|
|
114
|
+
// ---------------------------------------------------------------
|
|
115
|
+
function frameElement() {
|
|
116
|
+
var frame = document.querySelector('[class*="_frame"]');
|
|
117
|
+
if (frame) return frame;
|
|
118
|
+
var handle = document.querySelector('[data-side="sidebar"]');
|
|
119
|
+
return handle ? handle.parentElement : null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function currentSidebarWidth() {
|
|
123
|
+
var frame = frameElement();
|
|
124
|
+
if (!frame) return 0;
|
|
125
|
+
var track = String(getComputedStyle(frame).gridTemplateColumns || "").split(" ")[0];
|
|
126
|
+
var value = parseFloat(track);
|
|
127
|
+
return isNaN(value) ? 0 : value;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Drive the frame's own sidebar drag handle to the contract maximum, so the
|
|
132
|
+
* width lands in the layout store exactly like a user drag (clamping,
|
|
133
|
+
* animations and later manual drags all keep working).
|
|
134
|
+
*/
|
|
135
|
+
function defaultSidebarToMax() {
|
|
136
|
+
try {
|
|
137
|
+
if (document.querySelector("[data-sidebar-collapsed]")) return false;
|
|
138
|
+
var handle = document.querySelector('[data-side="sidebar"]');
|
|
139
|
+
if (!handle) return false;
|
|
140
|
+
var current = currentSidebarWidth();
|
|
141
|
+
if (!(current > 0) || current >= SIDEBAR_MAX - 1) return true;
|
|
142
|
+
var dx = SIDEBAR_MAX - current;
|
|
143
|
+
var setCapture = handle.setPointerCapture;
|
|
144
|
+
var hasCapture = handle.hasPointerCapture;
|
|
145
|
+
var releaseCapture = handle.releasePointerCapture;
|
|
146
|
+
handle.setPointerCapture = function () {};
|
|
147
|
+
handle.hasPointerCapture = function () {
|
|
148
|
+
return false;
|
|
149
|
+
};
|
|
150
|
+
handle.releasePointerCapture = function () {};
|
|
151
|
+
function fire(type, clientX) {
|
|
152
|
+
handle.dispatchEvent(
|
|
153
|
+
new PointerEvent(type, {
|
|
154
|
+
bubbles: true,
|
|
155
|
+
cancelable: true,
|
|
156
|
+
pointerId: 4242,
|
|
157
|
+
pointerType: "mouse",
|
|
158
|
+
isPrimary: true,
|
|
159
|
+
button: 0,
|
|
160
|
+
buttons: type === "pointerup" ? 0 : 1,
|
|
161
|
+
clientX: clientX,
|
|
162
|
+
clientY: 10,
|
|
163
|
+
})
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
try {
|
|
167
|
+
fire("pointerdown", 0);
|
|
168
|
+
fire("pointermove", dx);
|
|
169
|
+
fire("pointerup", dx);
|
|
170
|
+
} finally {
|
|
171
|
+
handle.setPointerCapture = setCapture;
|
|
172
|
+
handle.hasPointerCapture = hasCapture;
|
|
173
|
+
handle.releasePointerCapture = releaseCapture;
|
|
174
|
+
}
|
|
175
|
+
return true;
|
|
176
|
+
} catch (e) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
var widthTries = 0;
|
|
182
|
+
|
|
183
|
+
function ensureSidebarWidth() {
|
|
184
|
+
if (defaultSidebarToMax()) return;
|
|
185
|
+
widthTries += 1;
|
|
186
|
+
if (widthTries < 40) setTimeout(ensureSidebarWidth, 250);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// ---------------------------------------------------------------
|
|
190
|
+
// view-options menu entry
|
|
191
|
+
// ---------------------------------------------------------------
|
|
192
|
+
function isMenu(menu) {
|
|
193
|
+
return menu && menu.getAttribute && menu.getAttribute("role") === "menu" && (menu.className || "").indexOf("viewOptionsMenu") >= 0;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function isPlainLabel(el) {
|
|
197
|
+
return el.children.length === 0 && (el.textContent || "").trim() !== "";
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function injectMenu(menu) {
|
|
201
|
+
if (!isMenu(menu) || menu.dataset.wgPatched === "1") return;
|
|
202
|
+
var viewport = menu.querySelector('[class*="viewport"]') || menu;
|
|
203
|
+
var kids = Array.prototype.slice.call(viewport.children);
|
|
204
|
+
var labelIndex = -1;
|
|
205
|
+
for (var i = 0; i < kids.length; i++) {
|
|
206
|
+
if (isPlainLabel(kids[i]) && GROUP_LABEL.test(kids[i].textContent || "")) {
|
|
207
|
+
labelIndex = i;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (labelIndex < 0) return;
|
|
212
|
+
|
|
213
|
+
var lastRow = null;
|
|
214
|
+
var selectedRow = null;
|
|
215
|
+
for (var j = labelIndex + 1; j < kids.length; j++) {
|
|
216
|
+
if (isPlainLabel(kids[j])) break;
|
|
217
|
+
if (kids[j].querySelector('[role="menuitem"]')) {
|
|
218
|
+
lastRow = kids[j];
|
|
219
|
+
if (kids[j].querySelector('[class*="check"]')) selectedRow = kids[j];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (!lastRow) return;
|
|
223
|
+
|
|
224
|
+
var row = (selectedRow || lastRow).cloneNode(true);
|
|
225
|
+
var labelEl = row.querySelector('[class*="itemLabel"]');
|
|
226
|
+
if (labelEl) labelEl.textContent = LABEL;
|
|
227
|
+
var iconEl = row.querySelector('[class*="itemIcon"]');
|
|
228
|
+
if (iconEl) iconEl.innerHTML = GRID_ICON;
|
|
229
|
+
var checkEl = row.querySelector('[class*="check"]');
|
|
230
|
+
var button = row.querySelector("button");
|
|
231
|
+
if (!button) return;
|
|
232
|
+
if (button.getAttribute("aria-label")) button.setAttribute("aria-label", LABEL);
|
|
233
|
+
|
|
234
|
+
var selectedClass = null;
|
|
235
|
+
for (var c = 0; c < button.classList.length; c++) if (/selected/i.test(button.classList[c])) selectedClass = button.classList[c];
|
|
236
|
+
function syncRow() {
|
|
237
|
+
if (selectedClass) {
|
|
238
|
+
if (enabled) button.classList.add(selectedClass);
|
|
239
|
+
else button.classList.remove(selectedClass);
|
|
240
|
+
}
|
|
241
|
+
if (checkEl) checkEl.style.visibility = enabled ? "visible" : "hidden";
|
|
242
|
+
var role = button.getAttribute("role") || "";
|
|
243
|
+
if (role.indexOf("checkbox") >= 0 || role.indexOf("radio") >= 0) button.setAttribute("aria-checked", enabled ? "true" : "false");
|
|
244
|
+
}
|
|
245
|
+
syncRow();
|
|
246
|
+
|
|
247
|
+
button.addEventListener("click", function (event) {
|
|
248
|
+
event.preventDefault();
|
|
249
|
+
event.stopPropagation();
|
|
250
|
+
setEnabled(!enabled);
|
|
251
|
+
syncRow();
|
|
252
|
+
closeMenu();
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
lastRow.parentNode.insertBefore(row, lastRow.nextSibling);
|
|
256
|
+
menu.dataset.wgPatched = "1";
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function isViewOptionsTrigger(el) {
|
|
260
|
+
if (!el || !el.getAttribute || el.tagName !== "BUTTON") return false;
|
|
261
|
+
return /视图选项|view options/i.test(el.getAttribute("aria-label") || "");
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function viewOptionsTrigger() {
|
|
265
|
+
var scope = document.querySelector('[data-slot="sidebar.workspaces"]');
|
|
266
|
+
if (!scope) return null;
|
|
267
|
+
var buttons = Array.prototype.slice.call(scope.querySelectorAll("button"));
|
|
268
|
+
for (var i = 0; i < buttons.length; i++) if (isViewOptionsTrigger(buttons[i])) return buttons[i];
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function closeMenu() {
|
|
273
|
+
var trigger = viewOptionsTrigger();
|
|
274
|
+
if (trigger) trigger.click();
|
|
275
|
+
else document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
var observer = null;
|
|
279
|
+
|
|
280
|
+
function scanForMenus(node) {
|
|
281
|
+
if (!node || node.nodeType !== 1) return;
|
|
282
|
+
if (isMenu(node)) injectMenu(node);
|
|
283
|
+
var menus = node.querySelectorAll ? node.querySelectorAll('[role="menu"]') : [];
|
|
284
|
+
for (var i = 0; i < menus.length; i++) injectMenu(menus[i]);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function startObserver(doc) {
|
|
288
|
+
if (observer) return;
|
|
289
|
+
observer = new MutationObserver(function (mutations) {
|
|
290
|
+
for (var i = 0; i < mutations.length; i++) {
|
|
291
|
+
var added = mutations[i].addedNodes;
|
|
292
|
+
for (var j = 0; j < added.length; j++) scanForMenus(added[j]);
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
observer.observe(doc.body, { childList: true, subtree: true });
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// ---------------------------------------------------------------
|
|
299
|
+
// plugin lifecycle
|
|
300
|
+
// ---------------------------------------------------------------
|
|
301
|
+
function apply(ctx) {
|
|
302
|
+
applyState();
|
|
303
|
+
ensureStyle(document);
|
|
304
|
+
startObserver(document);
|
|
305
|
+
scanForMenus(document.body);
|
|
306
|
+
ensureSidebarWidth();
|
|
307
|
+
ctx.effect(function () {
|
|
308
|
+
return function () {
|
|
309
|
+
if (observer) observer.disconnect();
|
|
310
|
+
observer = null;
|
|
311
|
+
if (styleEl && styleEl.parentNode) styleEl.parentNode.removeChild(styleEl);
|
|
312
|
+
styleEl = null;
|
|
313
|
+
document.documentElement.removeAttribute(ATTR);
|
|
314
|
+
};
|
|
315
|
+
}, "workspace-grid: cleanup");
|
|
316
|
+
console.log("[workspace-grid] mounted, enabled=" + enabled);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
exports.apply = apply;
|
|
320
|
+
exports.inject = [];
|
|
321
|
+
exports.name = "workspace-grid";
|
|
322
|
+
return module.exports;
|
|
323
|
+
}
|
|
324
|
+
});
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host half of dsh-workspace-grid.
|
|
3
|
+
*
|
|
4
|
+
* The feature lives entirely in the browser: a view-options entry and the
|
|
5
|
+
* stylesheet it toggles. The node half registers nothing; it exists so the
|
|
6
|
+
* loader mounts this package's client bundle entry.
|
|
7
|
+
*/
|
|
8
|
+
export const name = 'workspace-grid'
|
|
9
|
+
|
|
10
|
+
export function apply() {}
|
package/locale/en.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "Workspace grid",
|
|
4
|
+
"description": "Lays the sidebar's workspace list out as three columns of tiles. The switch sits in the workspace view options menu, next to Group by, labelled Grid (3 columns); it is off by default, applies immediately and is remembered. A workspace without sessions becomes a compact tile with the folder icon above a name that wraps to three lines; a workspace that holds sessions or child workspaces keeps a full row, so session titles stay readable. The opened workspace and the selected session are highlighted with the accent color. On startup the plugin also widens the sidebar to the layout's 420px maximum, which you can still drag narrower afterwards. Only the arrangement changes: clicking, drag sorting, the context menu, hover cards and new sessions use the built-in interactions. State stays in local browser storage; no workspace files are read or written.",
|
|
5
|
+
"detail": "docs/DETAIL.md"
|
|
6
|
+
}
|
|
7
|
+
}
|
package/locale/zh.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "工作区九宫格",
|
|
4
|
+
"description": "把侧栏「工作区」列表排成三列瓦片。开关在「工作区」标题右边的「视图选项」菜单里,叫「九宫格(3 列)」,默认关闭,点一下即时生效并记住。开启后,没有会话的工作区变成文件夹图标在上、名称居中最多三行的小格;有会话或带子工作区的工作区仍占整行,会话列表宽度不变。点开的工作区和当前选中的会话都用强调色高亮。插件还会在启动时把侧栏宽度拉到最宽 420px(之后仍可手动拖窄)。只改排布:点击、拖拽排序、右键菜单、悬停卡片、新建会话全部沿用官方交互;数据只存在本机浏览器,不读写工作区文件。",
|
|
5
|
+
"detail": "docs/DETAIL.zh.md"
|
|
6
|
+
}
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-workspace-grid",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Shows the sidebar's workspace list as a three-column tile grid, toggled from the workspace view-options menu.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "John Xiao",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "lib/index.js",
|
|
9
|
+
"icon": "./icon.svg",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./lib/index.js",
|
|
12
|
+
"./client": "./lib/client.js",
|
|
13
|
+
"./locale/*.json": "./locale/*.json",
|
|
14
|
+
"./icon": "./icon.svg",
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"lib",
|
|
19
|
+
"locale",
|
|
20
|
+
"docs",
|
|
21
|
+
"cordis.patch.yml",
|
|
22
|
+
"icon.svg",
|
|
23
|
+
"README.md",
|
|
24
|
+
"README.zh.md",
|
|
25
|
+
"CHANGELOG.md",
|
|
26
|
+
"LICENSE"
|
|
27
|
+
],
|
|
28
|
+
"keywords": [
|
|
29
|
+
"dsh",
|
|
30
|
+
"dsh-plugin",
|
|
31
|
+
"deepseek-harness",
|
|
32
|
+
"sidebar",
|
|
33
|
+
"workspace",
|
|
34
|
+
"layout",
|
|
35
|
+
"grid"
|
|
36
|
+
],
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"dsh": ">=0.2.2-rc.5 <0.3.0",
|
|
42
|
+
"node": ">=22.19.0"
|
|
43
|
+
},
|
|
44
|
+
"dsh": {
|
|
45
|
+
"bundle": {
|
|
46
|
+
"patch": "./cordis.patch.yml"
|
|
47
|
+
},
|
|
48
|
+
"client": {
|
|
49
|
+
"platform": "web"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
6
52
|
}
|