dsh-sidebar-fold 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 drscrewdriver
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,108 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # dsh-sidebar-fold
2
+
3
+ Collapse the DSH sidebar's add-on entries into the shipped **“More”** row.
4
+
5
+ The left column's *Global panels* list grows with every installed plugin: schedules,
6
+ agent teams, the plugin market, context pages, … `dsh-sidebar-fold` puts a
7
+ **28×28 square arrow toggle** on the right end of the host's “More” row. One click
8
+ folds those add-on rows away so only the “More” line remains; the arrow flips from
9
+ ▲ (can collapse) to ▼ (can expand) and a second click brings the rows back.
10
+
11
+ - **Non-invasive** — a client plugin that only adds DOM. The host bundle is never
12
+ patched, nothing in `app.asar` is touched, and uninstalling restores the sidebar
13
+ exactly as shipped (own `<style>` tag and `data-dshsf-*` marks removed).
14
+ - **Structural header detection** — the header row is the `panelRow` carrying
15
+ `aria-haspopup="menu"` inside the “Global panels” nav, which is locale-independent
16
+ and independent of plugin registration order.
17
+ - **State per window** — the folded/open choice persists in `localStorage`, so a
18
+ reload keeps it.
19
+ - **Alignment switch** — the managed rows (the “More” row included) can put their
20
+ icon + label pair **left / centred / right**. At `right` the toggle mirrors to the
21
+ row's left end so it never covers the text; the override is a single
22
+ `justify-content` longhand and leaves the row's `display`/`gap`/height alone.
23
+ - **Configurable** — default state, the kept-visible rows and the row alignment live
24
+ in the plugin's settings card (host `Config`, `.volatile()`, applied without a
25
+ restart).
26
+ - **Rail-safe** — when the sidebar is collapsed to the 36 px icon rail the toggle is
27
+ removed and every row is shown again: no squeezing, no half-hidden state.
28
+ - **Quiet degradation** — if the host DOM drifts and the anchors are not found, the
29
+ plugin stays out of the way instead of breaking the sidebar (`dsh-sidebar-fold:
30
+ fold installed { mounted: false }` in the console tells you it happened).
31
+
32
+ ## Install
33
+
34
+ ```sh
35
+ # npm channel (after release)
36
+ dsh plugin --profile <profile> add dsh-sidebar-fold
37
+
38
+ # local build
39
+ npm run build && npm run verify
40
+ npm pack --pack-destination .
41
+ dsh plugin --profile <profile> add ./dsh-sidebar-fold-0.1.0.tgz
42
+ ```
43
+
44
+ Then add `dsh-sidebar-fold` to the profile's `dsh.profile.bundles` list (or
45
+ enable the bundle in the app) and restart. On the desktop profile, quit the Electron
46
+ app before editing its `package.json` — the running app rewrites that file and rolls
47
+ external edits back.
48
+
49
+ ## Settings
50
+
51
+ Open **Plugins → dsh-sidebar-fold** (the card is registered on the
52
+ `plugins.bundle.config` seat, keyed by the package name):
53
+
54
+ | Field | Meaning | Default |
55
+ |---|---|---|
56
+ | Folded by default | State a window starts in when it has no local record | off |
57
+ | Row alignment | Three-way segmented control (left / centre / right) for the managed rows; the “More” row follows the same setting | left |
58
+ | Entries kept visible | **One switch per row read from the live sidebar** — switch a row on to keep it visible while the rest fold | only `插件` / `Plugins` |
59
+
60
+ The row list is read from the DOM at open time, so a panel installed later shows up
61
+ without editing anything. When every row is switched on the toggle dims itself and
62
+ reports `aria-disabled="true"` instead of flipping an arrow over an unchanged list.
63
+
64
+ ## Development
65
+
66
+ ```sh
67
+ npm run build # scripts/build-client.mjs -> lib/client.js (module-loader bundle)
68
+ npm run verify # gate: loader id === package name, dual-manifest same string,
69
+ # no module request, no host primitives, 9 locales, no
70
+ # machine-absolute paths
71
+ npm test # node --test on the pure seams (header split, nav fallback chain)
72
+ npm run hosts:check # enumeration drift vs scripts/hosts.mjs (--write to repair)
73
+ ```
74
+
75
+ `prepack` runs build + verify, so a stale `lib/client.js` cannot be published.
76
+
77
+ ## Supported hosts
78
+
79
+ Enumerated per rc (never a range), single source of truth `scripts/hosts.mjs`:
80
+ `0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.3 || 0.1.7-rc.2 || 0.2.0-rc.2 || 0.2.1-rc.3`.
81
+
82
+ The DOM anchors were measured on **0.2.1-rc.3** (host-farm cell + real browser). The
83
+ other lines are declaration-level until each passes its own browser smoke; drop a
84
+ line from the table if it fails rather than let semver pass an untested host.
85
+
86
+ ## Upgrade guardrail
87
+
88
+ Host CSS-module hashes drift per build (`wtg9ga_` on rc.2 → `hHd-Xa_` on the rc.3
89
+ runtime), which is why every selector matches a *fragment* (`_panelList`, `_panelRow`,
90
+ `_moreAnchor`, `_collapsed`). **After any host upgrade, re-run the browser smoke**
91
+ before assuming the fold still mounts; the plugin degrades silently by design, so a
92
+ regression shows up as “nothing happened”, not as an error.
93
+
94
+ ## Layout
95
+
96
+ ```
97
+ src/index.js host half: Config schema + no-op apply (no build step)
98
+ src/client/constants.ts measured anchors, attribute marks, injected stylesheet
99
+ src/client/locales.ts 9 runtime dictionaries (zh = key-set source of truth)
100
+ src/client/fold.ts nav location, header/group split, toggle mount, fold state
101
+ src/client/settings-card.ts the bundle-page configuration card (plain DOM)
102
+ src/client/index.ts apply: fold first, then the guarded settings waists
103
+ scripts/ build-client / verify / sync-hosts / hosts / gen-locale-meta
104
+ ```
105
+
106
+ ## License
107
+
108
+ MIT
package/README.zh.md ADDED
@@ -0,0 +1,94 @@
1
+ # dsh-sidebar-fold
2
+
3
+ 把 DSH 左侧栏的「加项入口」收进宿主的 **「更多」行**。
4
+
5
+ 左侧栏的「全局面板」列表会随安装变长:自动化任务、agent 团队、插件市场、上下文页……
6
+ 本插件在宿主「更多」行右端挂一个 **28×28 的方形箭头按钮**。点一下把这些加项行整体收纳,
7
+ 只剩「更多」一行;箭头由 ▲(可收起)翻成 ▼(可展开),再点复原。
8
+
9
+ - **非侵入** —— 纯 client 插件,只新增 DOM。不打宿主补丁、不碰 `app.asar`;卸载后侧边栏
10
+ 与原版逐行一致(自持的 `<style>` 标签与 `data-dshsf-*` 标记一并清除)。
11
+ - **结构化定位头行** —— 头行 = 「全局面板」nav 内带 `aria-haspopup="menu"` 的 `panelRow`。
12
+ 不依赖任何文案,也不依赖插件注册顺序。
13
+ - **状态按窗口持久化** —— 折叠/展开记录在 `localStorage`,刷新后保持。
14
+ - **对齐可切换** —— 被管理的入口行(含「更多」行)的文字与图标可整体**左对齐 / 居中 / 右对齐**;
15
+ 右对齐时折叠钮自动镜像到行左端,不压文字。覆盖层只用宿主的 `justify-content` 长属性,
16
+ 不动行的 `display`/`gap`/高度。
17
+ - **可配置** —— 默认态、保持可见的行、行对齐都在插件设置卡里改(宿主 `Config` + `.volatile()`,
18
+ 保存即生效,不用重启)。
19
+ - **窄栏友好** —— 侧边栏收成 36px 图标栏时自动摘掉按钮并显示全部行:不挤压、不留半隐藏态。
20
+ - **静默降级** —— 宿主 DOM 漂移导致锚点找不到时,插件不注入、不改坏侧边栏;控制台会出现
21
+ `dsh-sidebar-fold: fold installed { mounted: false }` 告知未挂载。
22
+
23
+ ## 安装
24
+
25
+ ```sh
26
+ # npm 通道(发版后)
27
+ dsh plugin --profile <profile> add dsh-sidebar-fold
28
+
29
+ # 本地构建
30
+ npm run build && npm run verify
31
+ npm pack --pack-destination .
32
+ dsh plugin --profile <profile> add ./dsh-sidebar-fold-0.1.0.tgz
33
+ ```
34
+
35
+ 装完把 `dsh-sidebar-fold` 补进 profile 的 `dsh.profile.bundles`(或在应用内启用该
36
+ bundle)再重启。**desktop profile 必须先关停 Electron 应用**再改它的 `package.json`——
37
+ 运行中的桌面端会按自身内存态重写该文件并回滚外部修改。
38
+
39
+ ## 设置
40
+
41
+ 打开 **插件 → dsh-sidebar-fold**(配置卡注册在 `plugins.bundle.config` 席位,
42
+ key 为包名):
43
+
44
+ | 字段 | 含义 | 默认 |
45
+ |---|---|---|
46
+ | 默认折叠 | 窗口在没有本地记录时采用的初始状态 | 关 |
47
+ | 文字与图标对齐 | 三档分段控件(左 / 居中 / 右);作用于被折叠管理的入口行,「更多」行跟随同一档 | 左 |
48
+ | 保持可见的入口 | **按当前侧边栏实时读出的行逐个开关**;打开的行在折叠时保留可见 | 仅 `插件` / `Plugins` |
49
+
50
+ 行清单在打开卡片时从 DOM 读取,所以之后新装的入口会自动出现在列表里;如果全部都打开了,
51
+ 折叠钮会自动置灰并报 `aria-disabled="true"`,不会出现“箭头动了但什么都没变”。
52
+
53
+ ## 开发
54
+
55
+ ```sh
56
+ npm run build # scripts/build-client.mjs -> lib/client.js(模块加载器 bundle)
57
+ npm run verify # 门禁:loader id === 包名、双清单同串、无模块请求、
58
+ # 不引宿主 primitives、9 语词典、无机器绝对路径
59
+ npm test # node --test,覆盖纯逻辑面(头行/分组划分、nav 回退链)
60
+ npm run hosts:check # 与 scripts/hosts.mjs 的枚举漂移检查(--write 修复)
61
+ ```
62
+
63
+ `prepack` 会串起 build + verify,过期的 `lib/client.js` 发不出去。
64
+
65
+ ## 支持宿主
66
+
67
+ 逐 rc 精确枚举(禁用宽区间),唯一事实源 `scripts/hosts.mjs`:
68
+ `0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.3 || 0.1.7-rc.2 || 0.2.0-rc.2 || 0.2.1-rc.3`。
69
+
70
+ DOM 锚点只在 **0.2.1-rc.3** 上实测过(host-farm 格 + 真实浏览器取证)。其余线属于声明面,
71
+ 须逐格跑自己的浏览器冒烟;不过就从表里删掉,不能让 semver 巧合放行未测宿主。
72
+
73
+ ## 升级护栏
74
+
75
+ 宿主 CSS-module hash 每次构建都会漂移(rc.2 是 `wtg9ga_`,rc.3 运行时是 `hHd-Xa_`),
76
+ 所以所有选择器只匹配**片段**(`_panelList`、`_panelRow`、`_moreAnchor`、`_collapsed`)。
77
+ **宿主换代后必须重跑浏览器冒烟**再认定折叠仍在挂载:插件按设计静默降级,回归表现为
78
+ “什么都没发生”,不是报错。
79
+
80
+ ## 目录
81
+
82
+ ```
83
+ src/index.js 宿主半:Config schema + 空 apply(无需构建)
84
+ src/client/constants.ts 实测锚点、属性标记、注入的样式表
85
+ src/client/locales.ts 9 部运行时词典(zh 键集为真理源)
86
+ src/client/fold.ts nav 定位、头行/分组划分、按钮挂载、折叠状态
87
+ src/client/settings-card.ts bundle 详情页配置卡(纯 DOM)
88
+ src/client/index.ts apply:先装折叠,再各自带守卫地接设置腰
89
+ scripts/ build-client / verify / sync-hosts / hosts / gen-locale-meta
90
+ ```
91
+
92
+ ## 许可
93
+
94
+ MIT
@@ -0,0 +1,17 @@
1
+ # dsh-sidebar-fold bundle patch
2
+ #
3
+ # Assembly layer for the DSH profiles whose bundle list includes this package.
4
+ # A pure ADDITION: one insert row carrying an id no shipped entry uses. No
5
+ # shipped row is disabled, renamed, or reconfigured here, so the patch stays
6
+ # safe to compose with any other plugin's patch.
7
+ #
8
+ # The row exists so the loader has a host-side entry point (src/index.js, which
9
+ # installs nothing) and so the bundle's settings namespace is served under this
10
+ # package's name; every behaviour lives in the browser half (lib/client.js).
11
+ #
12
+ # Install (recommended, official CLI):
13
+ # dsh plugin --profile <profile> add dsh-sidebar-fold
14
+
15
+ - insert:
16
+ - id: dsh-sidebar-fold
17
+ name: dsh-sidebar-fold
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "dsh-external/dsh-sidebar-fold",
3
+ "version": "0.1.0",
4
+ "main": "./src/index.js",
5
+ "description": "折叠左侧栏加项入口:在宿主「更多」行挂一个 28×28 方形箭头按钮,把自动化任务、agent 团队、插件市场、上下文页等加项面板行收纳成一行,再点展开;折叠状态按窗口持久化。插件设置页可调默认态、保持可见的入口行(按当前侧边栏实时枚举),以及被管理行的文字与图标对齐(左/居中/右)。",
6
+ "engines": {
7
+ "dsh": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.3 || 0.1.7-rc.2 || 0.2.0-rc.2 || 0.2.1-rc.3"
8
+ },
9
+ "contributes": {
10
+ "tools": [],
11
+ "skills": []
12
+ },
13
+ "client": {
14
+ "main": "./lib/client.js"
15
+ }
16
+ }