dsh-nav-fold 0.2.0 → 0.3.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/CHANGELOG.md +31 -0
- package/README.md +16 -3
- package/lib/client.js +730 -24
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.2 — 2026-11-16
|
|
4
|
+
|
|
5
|
+
修复 0.3.1 固定方式带来的三个问题(K1–K3)。
|
|
6
|
+
|
|
7
|
+
- **改回原生滚动 + 双层 sticky**:不再重排外层布局,滚动仍由外壳负责 → 滚动条位置不变、侧栏宽度与自适应列数不再跳变
|
|
8
|
+
- 图标排与工作区标题行一起固定在顶部,只有文件夹与会话列表滚动
|
|
9
|
+
- 分隔线改为绝对定位满宽(图标档是 grid、收起档是 flex,之前 grid 下只占第一列)
|
|
10
|
+
- 找不到工作区标题行时降级为「仅固定导航」,侧栏不可见时挂起,均不影响布局
|
|
11
|
+
- 诊断区显示固定状态(已应用 / 仅固定导航 / 待定 / 未启用)与底色
|
|
12
|
+
|
|
13
|
+
## 0.3.1 — 2026-11-16
|
|
14
|
+
|
|
15
|
+
修正 0.3.0 的固定方式(0.3.0 未公开发布,仅内部迭代)。
|
|
16
|
+
|
|
17
|
+
- 改为「顶部固定区」:图标排(或收起行)与工作区标题(含搜索/视图/新建)一起固定在顶部,**只有工作区文件夹与会话列表滚动**
|
|
18
|
+
- 固定区底色运行时取自外壳背景,不再写死白底,浅色/深色下都不会出现色块
|
|
19
|
+
- 侧栏不可见时(如手机抽屉收起)挂起不误报,展开后自动落位
|
|
20
|
+
- 结构不匹配时自动回退为粘性导航,并在诊断区记录一条异常
|
|
21
|
+
- 诊断区新增「状态 / 最近告警 / 固定状态(含底色)」三行
|
|
22
|
+
- 其余沿用 0.3.0:列数(自适应/8/7/6/5/4,手机自适应最多 6 列)、与外壳「更多」共存、语言回退英文、观察器收窄
|
|
23
|
+
|
|
24
|
+
## 0.3.0 — 2026-11-16
|
|
25
|
+
|
|
26
|
+
- 图标档支持吸附:滚动会话列表时这排图标固定在侧栏顶部(默认开);收起档可吸附(默认关);文字档不提供(置灰并说明原因),避免把会话区挤没
|
|
27
|
+
- 图标档每行数量可选:自适应(默认,手机上最多 6 列)/ 8 / 7 / 6 / 5 / 4;选 7、8 列时会按侧栏实宽计算每列像素,低于 32px 给出提示并可一键切回自适应
|
|
28
|
+
- 与新版外壳共存:检测到侧栏自带「取消固定 / 更多」入口管理(rc.2+ 的 `button.panelUnpin`)时,收起态不再显示本插件的「全部」入口(可在设置里关闭该行为)
|
|
29
|
+
- 新增诊断区(默认折叠):结构版本、入口行数、档位、吸附与列数状态、最近一次告警时间,一键复制
|
|
30
|
+
- 语言回退修正:非中文环境缺词条时回退英文(此前回退中文,会中英混排)
|
|
31
|
+
- 性能:DOM 观察范围从整个 document 收窄到侧栏容器;另加 2 秒 `isConnected` 兜底,容器被整体替换时仍能自愈
|
|
32
|
+
- 设置面板新增「只重置控件样式」,可只把控件样式恢复成三档选择器
|
|
33
|
+
|
|
3
34
|
## 0.2.0 — 2026-11-15
|
|
4
35
|
|
|
5
36
|
适配 DSH 0.2.2-rc.2 / rc.3 的侧栏结构变化(入口行外面多了一层 `div.panelEntry`,行内新增「取消固定」按钮)。
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
## 为什么要它
|
|
10
10
|
|
|
11
|
-
侧栏顶部那串入口(Plugins / 自动化任务 / 上下文洞察 / …)是官方 `sidebar.panellist` 列表,每装一个带主面板的插件就多一行(36px)。实测 264px 宽的一列里 8 行占 **340px**,其下工作区/会话区只剩 **170px
|
|
11
|
+
侧栏顶部那串入口(Plugins / 自动化任务 / 上下文洞察 / …)是官方 `sidebar.panellist` 列表,每装一个带主面板的插件就多一行(36px)。实测 264px 宽的一列里 8 行占 **340px**,其下工作区/会话区只剩 **170px**;手机抽屉里更惨,旧版 DSH(0.2.2-rc.1 及更早)这块还不能滚动;新版官方已改为随侧栏一起滚动,本插件在此基础上提供「固定 / 跟随」开关,并额外支持三态折叠。
|
|
12
12
|
|
|
13
13
|
## 三种形态
|
|
14
14
|
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
| 图标网格 `compact` | 图标网格、隐文字(保留无障碍名)、行高 32px | **92px** |
|
|
19
19
|
| 收起 `hidden` | 只留「收起时保留」勾选的行(默认第一行)+「更多」锚点 | **100px** |
|
|
20
20
|
|
|
21
|
+
> 实测高度随列数与窗口宽度变化(下表是 264px 侧栏、7 列时的值)。
|
|
22
|
+
|
|
21
23
|
## 控制条在哪
|
|
22
24
|
|
|
23
25
|
挂在**被折叠那一组的末尾**(「更多」下面一行)——它的作用对象就是上面那几行,不是会话列表,也不是设置区:
|
|
@@ -45,6 +47,15 @@
|
|
|
45
47
|
| `cycle` | 一个按钮,**一次只显示当前档那一个图标**,点了换成下一档 |
|
|
46
48
|
| `header` | **标题行**:整组收成一行 `⌃ 功能入口 8`(位于入口列表最上方),点标题展开/收起;只有"文字行 / 收起"两态,图标网格档不可用。被外壳挪位会自动拉回,连续 3 次失败退回 `segmented` |
|
|
47
49
|
|
|
50
|
+
## 固定顶部区域与列数(0.3.2)
|
|
51
|
+
|
|
52
|
+
- **官方行为**:整栏一起滚动。开启「固定顶部区域」后,图标排与工作区标题固定、只有文件夹与会话列表滚动;关闭则完全跟随官方。
|
|
53
|
+
- **固定顶部区域**:图标档默认开启——图标排 + 工作区标题(含搜索/视图/新建)一起固定在顶部,**只有文件夹与会话列表滚动**;收起档可选(默认关);文字档不提供(行数多,固定会把会话区挤没)
|
|
54
|
+
- **底色**:固定区背景在运行时取自外壳侧栏颜色,不写死白底,浅色/深色都不会出现色块
|
|
55
|
+
- **每行几个**:自适应(默认,手机上最多 6 列)/ 8 / 7 / 6 / 5 / 4;写死 7、8 列时按侧栏实际宽度提示是否过挤,可一键切回自适应
|
|
56
|
+
- **与外壳共存**:侧栏自带「取消固定 / 更多」(DSH 0.2.2-rc.2 起)时,收起态只保留外壳的菜单,避免两个入口菜单并存
|
|
57
|
+
- **诊断**:设置面板底部可展开,显示结构版本、行数、档位、吸附与列数、最近一次告警时间,可一键复制
|
|
58
|
+
|
|
48
59
|
## 设置面板(设置 → nav-fold 导航折叠)
|
|
49
60
|
|
|
50
61
|
行式布局,与 shell 自己的设置项一致:
|
|
@@ -90,6 +101,8 @@ dsh plugin --profile web add dsh-nav-fold
|
|
|
90
101
|
sudo systemctl restart dsh-web # 首次安装需要重启 Host 才会加载浏览器半
|
|
91
102
|
```
|
|
92
103
|
|
|
104
|
+
> 若你的 npm 源指向镜像(如 npmmirror),可能拉不到最新版本,可加 `--registry=https://registry.npmjs.org`。
|
|
105
|
+
|
|
93
106
|
### 从源码(开发/二次修改)
|
|
94
107
|
|
|
95
108
|
```bash
|
|
@@ -116,10 +129,10 @@ node --test test/*.test.mjs # 14 项,直接测上线产物 lib/client.js(v
|
|
|
116
129
|
|
|
117
130
|
## 版本契约(升级 DSH 后看这里)
|
|
118
131
|
|
|
119
|
-
- 支持 **DSH >= 0.2.2-rc.1 < 0.3.0**(实测 rc.1 / rc.3
|
|
132
|
+
- 支持 **DSH >= 0.2.2-rc.1 < 0.3.0**(实测 rc.1 / rc.2 / rc.3;rc.2 起入口行多一层 `div.panelEntry`)
|
|
120
133
|
- 侧栏入口行两种结构都适配:
|
|
121
134
|
- rc.1 及更早:`nav > button.panelRow`
|
|
122
135
|
- rc.2 起:`nav > div.panelEntry > button.panelRow`(行内可能还有「取消固定」按钮)
|
|
123
136
|
- 判据只看结构(标签层级 + aria-label),不认宿主 CSS Modules 的哈希类名
|
|
124
137
|
- 找不到入口导航时保持原生 UI,并在控制台打印一条结构诊断
|
|
125
|
-
- 升级 DSH 后若失效:先看那行诊断,再到仓库提 issue
|
|
138
|
+
- 升级 DSH 后若失效:先看那行诊断,再到仓库提 issue
|
package/lib/client.js
CHANGED
|
@@ -29,7 +29,7 @@ const react = require("react");
|
|
|
29
29
|
/** 插件名(cordis 插件标识) */
|
|
30
30
|
const name = "nav-fold";
|
|
31
31
|
/** 版本号:必须与 package.json.version 一致(有单测守着) */
|
|
32
|
-
const PLUGIN_VERSION = "0.2
|
|
32
|
+
const PLUGIN_VERSION = "0.3.2";
|
|
33
33
|
/** 设置分区 / 控制条占用者 id */
|
|
34
34
|
const ENTRY_ID = "nav-fold";
|
|
35
35
|
/** 注入样式表的幂等标记 */
|
|
@@ -46,6 +46,20 @@ const STORAGE_KEEP = "dsh-nav-fold/v1/keep";
|
|
|
46
46
|
const STORAGE_STASH = "dsh-nav-fold/v1/mode-stash";
|
|
47
47
|
/** localStorage:控件模型 */
|
|
48
48
|
const STORAGE_MODEL = "dsh-nav-fold/v1/model";
|
|
49
|
+
/** 图标档每行列数:auto / 8 / 7 / 6 / 5 / 4 */
|
|
50
|
+
const STORAGE_COLS = "dsh-nav-fold/v1/cols";
|
|
51
|
+
/** 图标档是否吸附在顶部 */
|
|
52
|
+
const STORAGE_STICK_COMPACT = "dsh-nav-fold/v1/stick-compact";
|
|
53
|
+
/** 收起档是否吸附在顶部 */
|
|
54
|
+
const STORAGE_STICK_HIDDEN = "dsh-nav-fold/v1/stick-hidden";
|
|
55
|
+
/** 外壳已有「更多」时,是否隐藏我们自己的「全部」入口 */
|
|
56
|
+
const STORAGE_SHELL_MORE = "dsh-nav-fold/v1/shell-more";
|
|
57
|
+
/** 列数可选值(字符串形式存盘) */
|
|
58
|
+
const COLS_OPTIONS = ["auto", "8", "7", "6", "5", "4"];
|
|
59
|
+
/** 每列可用的最小像素(图标 18px + 内边距),低于它判定为“挤” */
|
|
60
|
+
const COL_MIN_PX = 32;
|
|
61
|
+
/** 工作区标题行的标记属性(只用来挂 sticky,不重排布局) */
|
|
62
|
+
const PIN_ATTR_HEAD = "data-navfold-pin-head";
|
|
49
63
|
/** 命中导航元素的标记属性,三态值写在这个属性上 */
|
|
50
64
|
const NAV_ATTR = "data-navfold";
|
|
51
65
|
/** 自有控制条的标记属性 */
|
|
@@ -114,6 +128,21 @@ const DICT = {
|
|
|
114
128
|
"settings.keep.none": "清空",
|
|
115
129
|
"settings.restore": "恢复默认",
|
|
116
130
|
"settings.restore.confirm": "再点一次确认",
|
|
131
|
+
"settings.resetModel": "只重置控件样式",
|
|
132
|
+
"settings.cells.title": "每行几个",
|
|
133
|
+
"settings.cells.auto": "自适应",
|
|
134
|
+
"settings.cells.desc": "只影响图标档。自适应按侧栏宽度排版(手机上最多 6 列);写死列数在窄侧栏或手机上可能挤压。",
|
|
135
|
+
"settings.cells.warn": "当前侧栏约 {width}px,{cols} 列每列仅 {px}px,可能挤压;显示异常请切回「自适应」。",
|
|
136
|
+
"settings.cells.warnMobile": "手机宽度下建议用「自适应」(最多 6 列),写死 {cols} 列容易挤压。",
|
|
137
|
+
"settings.cells.revert": "切回自适应",
|
|
138
|
+
"settings.stick.title": "固定顶部区域",
|
|
139
|
+
"settings.stick.compact.desc": "图标排与工作区标题一起固定在顶部,只有文件夹和会话列表滚动;底色跟随外壳,不会出现色块。",
|
|
140
|
+
"settings.stick.hidden.desc": "收起时只留一行(含「全部」入口);开启后这一行与工作区标题固定,仅列表滚动。",
|
|
141
|
+
"settings.shell.title": "与外壳共存",
|
|
142
|
+
"settings.shell.desc": "新版左侧栏自带「更多」(列出未固定的入口)。开启后收起时只保留外壳那一个,避免两个入口菜单并存。",
|
|
143
|
+
"settings.diag.title": "诊断",
|
|
144
|
+
"settings.diag.copy": "复制",
|
|
145
|
+
"settings.diag.copyFailed": "复制失败,请手动选择文本",
|
|
117
146
|
"settings.rail.hint": "56px 图标轨里两种样式都会收成一个图标,点一下换档。"
|
|
118
147
|
},
|
|
119
148
|
en: {
|
|
@@ -169,6 +198,21 @@ const DICT = {
|
|
|
169
198
|
"settings.keep.none": "None",
|
|
170
199
|
"settings.restore": "Restore defaults",
|
|
171
200
|
"settings.restore.confirm": "Click again to confirm",
|
|
201
|
+
"settings.resetModel": "Reset control style only",
|
|
202
|
+
"settings.cells.title": "Icons per row",
|
|
203
|
+
"settings.cells.auto": "Auto",
|
|
204
|
+
"settings.cells.desc": "Only affects the icon grid. Auto follows the sidebar width (6 columns max on phones); a fixed count may feel cramped on narrow sidebars.",
|
|
205
|
+
"settings.cells.warn": "Sidebar is about {width}px — {cols} columns give only {px}px each. Switch back to Auto if it looks cramped.",
|
|
206
|
+
"settings.cells.warnMobile": "On a phone width, Auto (6 columns max) is recommended; a fixed {cols} columns will feel cramped.",
|
|
207
|
+
"settings.cells.revert": "Use Auto",
|
|
208
|
+
"settings.stick.title": "Pin top area",
|
|
209
|
+
"settings.stick.compact.desc": "Keeps the icon row and the workspace title pinned; only folders and the session list scroll. Background follows the shell, so no colour block appears.",
|
|
210
|
+
"settings.stick.hidden.desc": "Collapsed mode keeps a single row (with the All entry); pin it so the row and the workspace title stay put while only the list scrolls.",
|
|
211
|
+
"settings.shell.title": "Coexist with shell",
|
|
212
|
+
"settings.shell.desc": "Newer sidebars ship their own More menu (unpinned entries). When on, collapsed mode keeps only the shell menu to avoid two entry menus.",
|
|
213
|
+
"settings.diag.title": "Diagnostics",
|
|
214
|
+
"settings.diag.copy": "Copy",
|
|
215
|
+
"settings.diag.copyFailed": "Copy failed, select the text manually",
|
|
172
216
|
"settings.rail.hint": "In the 56px rail both styles reduce to a single icon you click to advance."
|
|
173
217
|
}
|
|
174
218
|
};
|
|
@@ -270,6 +314,25 @@ const CSS_TEXT = [
|
|
|
270
314
|
'nav[data-navfold="compact"]>div:not([' + BAR_ATTR + '])>button>span+span{position:absolute!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;overflow:hidden!important;clip:rect(0 0 0 0)!important;white-space:nowrap!important;border:0!important}',
|
|
271
315
|
'nav[data-navfold="compact"]>div:not([' + BAR_ATTR + '])>button:not([class*="panelRow"]){display:none!important}',
|
|
272
316
|
'nav[data-navfold="hidden"]>div:not([data-navfold-keep]):not([' + BAR_ATTR + ']){display:none!important}',
|
|
317
|
+
// 图标档列数:8/7/6/5/4 写死;自适应在手机上最多 6 列
|
|
318
|
+
'nav[data-navfold="compact"][data-navfold-cols="8"]{grid-template-columns:repeat(8,minmax(0,1fr))!important}',
|
|
319
|
+
'nav[data-navfold="compact"][data-navfold-cols="7"]{grid-template-columns:repeat(7,minmax(0,1fr))!important}',
|
|
320
|
+
'nav[data-navfold="compact"][data-navfold-cols="6"]{grid-template-columns:repeat(6,minmax(0,1fr))!important}',
|
|
321
|
+
'nav[data-navfold="compact"][data-navfold-cols="5"]{grid-template-columns:repeat(5,minmax(0,1fr))!important}',
|
|
322
|
+
'nav[data-navfold="compact"][data-navfold-cols="4"]{grid-template-columns:repeat(4,minmax(0,1fr))!important}',
|
|
323
|
+
'@media (max-width:767px){nav[data-navfold="compact"][data-navfold-cols="auto"]{grid-template-columns:repeat(6,minmax(0,1fr))!important}}',
|
|
324
|
+
'nav[data-navfold="compact"][data-navfold-cols="8"]>button,nav[data-navfold="compact"][data-navfold-cols="8"]>div>button{height:30px!important;min-height:30px!important}',
|
|
325
|
+
'nav[data-navfold="compact"][data-navfold-cols="5"]>button,nav[data-navfold="compact"][data-navfold-cols="5"]>div>button,nav[data-navfold="compact"][data-navfold-cols="4"]>button,nav[data-navfold="compact"][data-navfold-cols="4"]>div>button{height:36px!important;min-height:36px!important}',
|
|
326
|
+
// 顶部固定区:原生滚动不变,nav 与工作区标题行用 sticky 贴在滚动口(不重排布局 → 宽度/列数不变)
|
|
327
|
+
'nav[data-navfold-pinned="on"],nav[data-navfold-pinned="nav-only"]{position:sticky!important;top:0!important;z-index:4!important;background:var(--navfold-pin-bg,transparent)!important}',
|
|
328
|
+
'[data-navfold-pin-head]{position:sticky!important;top:var(--navfold-nav-h,92px)!important;z-index:3!important;background:var(--navfold-pin-bg,transparent)!important}',
|
|
329
|
+
// 分隔线用绝对定位:grid(图标档)与 flex(收起档)下都满宽
|
|
330
|
+
'nav[data-navfold-pinned="on"]::after,nav[data-navfold-pinned="nav-only"]::after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:1px;pointer-events:none;background:linear-gradient(to right,transparent 0%,var(--dsw-alias-border-l1,rgba(0,0,0,.14)) 22%,var(--dsw-alias-border-l1,rgba(0,0,0,.14)) 78%,transparent 100%)}',
|
|
331
|
+
// 设置面板:列数/吸附选中态沿用控件样式那套,提示用状态色
|
|
332
|
+
'[data-navfold-cols-btn][aria-checked="true"]{background:var(--dsw-alias-bg-layer-1,#fff);color:var(--dsw-alias-label-primary,#111);border-color:var(--dsw-alias-label-tertiary,rgba(0,0,0,.28));font-weight:600;box-shadow:0 1px 2px rgba(0,0,0,.06)}',
|
|
333
|
+
'[data-navfold-warn]{margin:0;font-size:12px;line-height:1.5;color:var(--dsw-alias-state-warning-primary,#b26a00)}',
|
|
334
|
+
'[data-navfold-warn] button{margin-left:6px;padding:1px 8px;font-size:12px;border:1px solid currentColor;border-radius:6px;background:transparent;color:inherit;cursor:pointer}',
|
|
335
|
+
'[data-navfold-diag]{margin:0;padding:8px 10px;border-radius:8px;background:var(--dsw-alias-bg-layer-2,rgba(0,0,0,.04));font-size:11px;line-height:1.6;white-space:pre-wrap;word-break:break-all;color:var(--dsw-alias-label-secondary,#555);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}',
|
|
273
336
|
"nav[data-navfold]>[" + BAR_ATTR + "] [data-navfold-count]{margin-right:2px;font-variant-numeric:tabular-nums;opacity:.8}",
|
|
274
337
|
"nav[data-navfold]>[" + BAR_ATTR + "]{display:flex;align-items:center;justify-content:flex-end;gap:2px;height:22px;margin-top:2px;padding:0 2px;font-size:11px;line-height:1;color:var(--dsw-alias-label-tertiary,#8a8a8a)}",
|
|
275
338
|
'nav[data-navfold="compact"]>[' + BAR_ATTR + "]{grid-column:1/-1}",
|
|
@@ -284,10 +347,11 @@ const CSS_TEXT = [
|
|
|
284
347
|
"[data-navfold-model]{border:1px solid transparent;background:transparent;color:var(--dsw-alias-label-secondary,#666);border-radius:6px;cursor:pointer}",
|
|
285
348
|
"[data-navfold-model]:hover{background:var(--dsw-alias-bg-layer-2,rgba(128,128,128,.12))}",
|
|
286
349
|
'[data-navfold-model][aria-checked="true"]{background:var(--dsw-alias-bg-layer-1,#fff);color:var(--dsw-alias-label-primary,#111);border-color:var(--dsw-alias-label-tertiary,rgba(0,0,0,.28));font-weight:600;box-shadow:0 1px 2px rgba(0,0,0,.06)}',
|
|
287
|
-
"[data-navfold-
|
|
288
|
-
'[data-navfold-
|
|
289
|
-
"[data-navfold-
|
|
290
|
-
'[data-navfold-
|
|
350
|
+
"[data-navfold-switch]{position:relative;width:38px;height:22px;padding:0;border:none;border-radius:999px;background:var(--dsw-alias-border-l2,rgba(0,0,0,.15));cursor:pointer;flex:0 0 auto}",
|
|
351
|
+
'[data-navfold-switch][aria-checked="true"]{background:var(--dsw-alias-accent,#4d6bfe)}',
|
|
352
|
+
"[data-navfold-switch]>span{position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:999px;background:#fff;transition:left .12s ease}",
|
|
353
|
+
'[data-navfold-switch][aria-checked="true"]>span{left:19px}',
|
|
354
|
+
"[data-navfold-switch][disabled]{cursor:not-allowed;opacity:.45}",
|
|
291
355
|
"[data-navfold-keep-row]{display:inline-flex;align-items:center;gap:4px;padding:3px 8px;border-radius:6px;border:1px solid var(--dsw-alias-border-l2,rgba(0,0,0,.15));background:transparent;color:var(--dsw-alias-label-primary,#111);font-size:12px;line-height:1.5;cursor:pointer}",
|
|
292
356
|
"[data-navfold-keep-row]:hover{border-color:var(--dsw-alias-label-tertiary,rgba(0,0,0,.3))}",
|
|
293
357
|
'[data-navfold-keep-row][aria-pressed="true"]{border-color:var(--dsw-alias-accent,#4d6bfe);background:var(--dsw-alias-bg-layer-2,rgba(77,107,254,.10))}',
|
|
@@ -330,7 +394,23 @@ const runtime = {
|
|
|
330
394
|
headerDrift: 0,
|
|
331
395
|
modeStash: null,
|
|
332
396
|
confirmReset: false,
|
|
333
|
-
resetTimer: 0
|
|
397
|
+
resetTimer: 0,
|
|
398
|
+
diagOpen: false,
|
|
399
|
+
cols: "auto",
|
|
400
|
+
stickCompact: true,
|
|
401
|
+
stickHidden: false,
|
|
402
|
+
hideAllWhenShellMore: true,
|
|
403
|
+
shellHasMore: false,
|
|
404
|
+
stuck: false,
|
|
405
|
+
structure: "unknown",
|
|
406
|
+
lastWarnAt: 0,
|
|
407
|
+
observedTarget: null,
|
|
408
|
+
poll: 0,
|
|
409
|
+
pinState: "off",
|
|
410
|
+
pinRetry: 0,
|
|
411
|
+
pinNodes: null,
|
|
412
|
+
pinBg: "",
|
|
413
|
+
anomalies: []
|
|
334
414
|
};
|
|
335
415
|
|
|
336
416
|
/* ───────────────────────── 纯函数(可单测) ───────────────────────── */
|
|
@@ -369,6 +449,222 @@ function resolveAuto(stored) {
|
|
|
369
449
|
return stored !== "off";
|
|
370
450
|
}
|
|
371
451
|
|
|
452
|
+
/**
|
|
453
|
+
* 解析开关型存档(on / off),缺省用默认值。
|
|
454
|
+
* @param stored - localStorage 原始值。
|
|
455
|
+
* @param fallback - 没有存档时的默认。
|
|
456
|
+
* @returns 布尔。
|
|
457
|
+
*/
|
|
458
|
+
function resolveFlag(stored, fallback) {
|
|
459
|
+
if (stored === "on") return true;
|
|
460
|
+
if (stored === "off") return false;
|
|
461
|
+
return fallback;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* 解析图标档列数。
|
|
466
|
+
* @param stored - localStorage 原始值。
|
|
467
|
+
* @returns auto / 8 / 7 / 6 / 5 / 4。
|
|
468
|
+
*/
|
|
469
|
+
function resolveCols(stored) {
|
|
470
|
+
return typeof stored === "string" && COLS_OPTIONS.indexOf(stored) !== -1 ? stored : "auto";
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* 外壳是否自带「更多」/取消固定一类的入口管理(rc.2 起每行有 button.panelUnpin)。
|
|
475
|
+
* 命中时我们收起态的「全部」菜单就不再显示,避免两个入口菜单并存。
|
|
476
|
+
* @param nav - 命中的 nav。
|
|
477
|
+
* @returns 是否自带。
|
|
478
|
+
*/
|
|
479
|
+
function classOf(el) {
|
|
480
|
+
if (!el) return "";
|
|
481
|
+
const viaAttr = typeof el.getAttribute === "function" ? el.getAttribute("class") || "" : "";
|
|
482
|
+
const viaProp = typeof el.className === "string" ? el.className : "";
|
|
483
|
+
return (viaProp + " " + viaAttr).trim();
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function detectShellMore(nav) {
|
|
487
|
+
const kids = nav && nav.children ? nav.children : [];
|
|
488
|
+
for (let i = 0; i < kids.length; i += 1) {
|
|
489
|
+
const kid = kids[i];
|
|
490
|
+
if (!kid) continue;
|
|
491
|
+
if (kid.tagName === "BUTTON" && classOf(kid).indexOf("panelUnpin") !== -1) return true;
|
|
492
|
+
const inner = kid.children || [];
|
|
493
|
+
for (let j = 0; j < inner.length; j += 1) {
|
|
494
|
+
if (inner[j] && inner[j].tagName === "BUTTON" && classOf(inner[j]).indexOf("panelUnpin") !== -1) return true;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return false;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/** 当前模式是否应启用「顶部固定区」。 */
|
|
501
|
+
function wantsPin() {
|
|
502
|
+
return (runtime.mode === "compact" && runtime.stickCompact) || (runtime.mode === "hidden" && runtime.stickHidden);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/** 元素高度(取不到返回 0)。 */
|
|
506
|
+
function rectHeight(el) {
|
|
507
|
+
if (!el || typeof el.getBoundingClientRect !== "function") return 0;
|
|
508
|
+
try {
|
|
509
|
+
return el.getBoundingClientRect().height || 0;
|
|
510
|
+
} catch (err) {
|
|
511
|
+
return 0;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* 在子树里找「短标题(<64)+ 高列表(>120)」的容器——不认类名,只看尺寸与层级。
|
|
517
|
+
* @param node - 起点。
|
|
518
|
+
* @param depth - 递归深度(上限 6)。
|
|
519
|
+
* @returns 容器元素或 null。
|
|
520
|
+
*/
|
|
521
|
+
function findStack(node, depth) {
|
|
522
|
+
if (!node || depth > 6) return null;
|
|
523
|
+
const kids = node.children || [];
|
|
524
|
+
if (kids.length >= 2) {
|
|
525
|
+
const head = rectHeight(kids[0]);
|
|
526
|
+
const body = rectHeight(kids[1]);
|
|
527
|
+
if (head > 0 && head < 64 && body > 120) return node;
|
|
528
|
+
}
|
|
529
|
+
for (let i = 0; i < kids.length; i += 1) {
|
|
530
|
+
const hit = findStack(kids[i], depth + 1);
|
|
531
|
+
if (hit) return hit;
|
|
532
|
+
}
|
|
533
|
+
return null;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* 探测顶部固定区需要的节点:滚动区 + 工作区标题行。
|
|
538
|
+
* 只用来给标题行打标,不改布局(0.3.1 的布局重排已废弃)。
|
|
539
|
+
* @param nav - 命中的 nav。
|
|
540
|
+
* @returns { area, head } 或 null。
|
|
541
|
+
*/
|
|
542
|
+
function findPinTargets(nav) {
|
|
543
|
+
const area = nav && (nav.parentElement || nav.parentNode);
|
|
544
|
+
if (!area || !area.children) return null;
|
|
545
|
+
let region = null;
|
|
546
|
+
for (let i = 0; i < area.children.length; i += 1) {
|
|
547
|
+
const kid = area.children[i];
|
|
548
|
+
if (kid === nav || kid === runtime.bar || isOwnBar(kid)) continue;
|
|
549
|
+
region = kid;
|
|
550
|
+
break;
|
|
551
|
+
}
|
|
552
|
+
if (!region) return null;
|
|
553
|
+
const stack = findStack(region, 0);
|
|
554
|
+
if (!stack || !stack.children || stack.children.length < 2) return null;
|
|
555
|
+
return { area: area, head: stack.children[0] };
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* 读面板底色:自身透明就向上找;取不到返回 transparent(宁可不涂色,也不制造色块)。
|
|
560
|
+
* @param el - 起点。
|
|
561
|
+
* @returns CSS 颜色字符串。
|
|
562
|
+
*/
|
|
563
|
+
function readPanelBg(el) {
|
|
564
|
+
let cur = el;
|
|
565
|
+
for (let i = 0; i < 6 && cur; i += 1) {
|
|
566
|
+
try {
|
|
567
|
+
const bg = window.getComputedStyle(cur).backgroundColor;
|
|
568
|
+
if (bg && bg !== "transparent" && bg !== "rgba(0, 0, 0, 0)") return bg;
|
|
569
|
+
} catch (err) {
|
|
570
|
+
/* 继续向上找 */
|
|
571
|
+
}
|
|
572
|
+
cur = cur.parentElement || cur.parentNode;
|
|
573
|
+
}
|
|
574
|
+
return "transparent";
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/** 记一条异常(最多留 3 条,供诊断区显示)。 */
|
|
578
|
+
function noteAnomaly(kind) {
|
|
579
|
+
runtime.anomalies.unshift({ kind: kind, at: Date.now() });
|
|
580
|
+
runtime.anomalies = runtime.anomalies.slice(0, 3);
|
|
581
|
+
runtime.lastWarnAt = runtime.anomalies[0].at;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/** 清掉固定区标记(只摘标题行标记,不动外壳布局)。 */
|
|
585
|
+
function clearPin() {
|
|
586
|
+
const nodes = runtime.pinNodes;
|
|
587
|
+
if (nodes && nodes.head && typeof nodes.head.removeAttribute === "function") {
|
|
588
|
+
nodes.head.removeAttribute(PIN_ATTR_HEAD);
|
|
589
|
+
}
|
|
590
|
+
runtime.pinNodes = null;
|
|
591
|
+
runtime.pinBg = "";
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* 把 nav 高度写进滚动区变量,供标题行 sticky 的 top 使用。
|
|
596
|
+
* @param area - 滚动区。
|
|
597
|
+
* @param nav - 命中的 nav。
|
|
598
|
+
*/
|
|
599
|
+
function syncNavHeight(area, nav) {
|
|
600
|
+
if (!area || !area.style || typeof area.style.setProperty !== "function") return;
|
|
601
|
+
const height = Math.round(rectHeight(nav));
|
|
602
|
+
if (!height) return;
|
|
603
|
+
try {
|
|
604
|
+
area.style.setProperty("--navfold-nav-h", height + "px");
|
|
605
|
+
} catch (err) {
|
|
606
|
+
/* 设不上就退回 CSS 默认值 */
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* 应用 / 撤销顶部固定区。
|
|
612
|
+
* @param nav - 命中的 nav。
|
|
613
|
+
* @returns applied / fallback / off。
|
|
614
|
+
*/
|
|
615
|
+
function applyPin(nav) {
|
|
616
|
+
if (!wantsPin()) {
|
|
617
|
+
clearPin();
|
|
618
|
+
runtime.pinState = "off";
|
|
619
|
+
return "off";
|
|
620
|
+
}
|
|
621
|
+
const areaNode = nav.parentElement || nav.parentNode;
|
|
622
|
+
if (!rectHeight(areaNode)) {
|
|
623
|
+
// 侧栏在手机抽屉里、或整块不可见时高度为 0:先挂起,等它出现再固定,不记异常
|
|
624
|
+
clearPin();
|
|
625
|
+
runtime.pinState = "pending";
|
|
626
|
+
return "pending";
|
|
627
|
+
}
|
|
628
|
+
// 底色与导航高度都挂在滚动区上:nav 与标题行共用
|
|
629
|
+
runtime.pinBg = readPanelBg(areaNode);
|
|
630
|
+
try {
|
|
631
|
+
if (areaNode.style && typeof areaNode.style.setProperty === "function") {
|
|
632
|
+
areaNode.style.setProperty("--navfold-pin-bg", runtime.pinBg);
|
|
633
|
+
}
|
|
634
|
+
} catch (err) {
|
|
635
|
+
/* 设不上就退回 transparent */
|
|
636
|
+
}
|
|
637
|
+
syncNavHeight(areaNode, nav);
|
|
638
|
+
const targets = findPinTargets(nav);
|
|
639
|
+
if (!targets) {
|
|
640
|
+
// 找不到工作区标题行:只固定导航(等价 0.3.0 行为),不记异常以外的副作用
|
|
641
|
+
clearPin();
|
|
642
|
+
runtime.pinNodes = { area: areaNode, head: null };
|
|
643
|
+
runtime.pinState = "nav-only";
|
|
644
|
+
return "nav-only";
|
|
645
|
+
}
|
|
646
|
+
if (runtime.pinNodes && runtime.pinNodes.head && runtime.pinNodes.head !== targets.head) {
|
|
647
|
+
if (typeof runtime.pinNodes.head.removeAttribute === "function") runtime.pinNodes.head.removeAttribute(PIN_ATTR_HEAD);
|
|
648
|
+
}
|
|
649
|
+
if (typeof targets.head.setAttribute === "function") targets.head.setAttribute(PIN_ATTR_HEAD, "");
|
|
650
|
+
runtime.pinNodes = targets;
|
|
651
|
+
runtime.pinState = "applied";
|
|
652
|
+
return "applied";
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* 记录当前侧栏结构版本:flat(rc.1 及更早)/ wrapped(rc.2 起,行外多一层 div)。
|
|
657
|
+
* @param nav - 命中的 nav。
|
|
658
|
+
* @returns 结构标记。
|
|
659
|
+
*/
|
|
660
|
+
function detectStructure(nav) {
|
|
661
|
+
const kids = nav && nav.children ? nav.children : [];
|
|
662
|
+
for (let i = 0; i < kids.length; i += 1) {
|
|
663
|
+
if (kids[i] && kids[i].tagName === "DIV" && findRowButton(kids[i])) return "wrapped";
|
|
664
|
+
}
|
|
665
|
+
return "flat";
|
|
666
|
+
}
|
|
667
|
+
|
|
372
668
|
/**
|
|
373
669
|
* 决定控件模型:已存值优先,否则三档选择器。
|
|
374
670
|
* @param stored - localStorage 里的原始值。
|
|
@@ -749,10 +1045,14 @@ function renderBar() {
|
|
|
749
1045
|
bar.appendChild(badge);
|
|
750
1046
|
}
|
|
751
1047
|
// 图标轨里放不下排布,两种模型都退化成单按钮循环
|
|
752
|
-
const
|
|
1048
|
+
const skipAll = runtime.shellHasMore && runtime.hideAllWhenShellMore;
|
|
1049
|
+
const allButton = () => (skipAll ? null : makeAction(doc, "all", t("bar.all"), t("bar.all.title"), LIST_ICON));
|
|
753
1050
|
if (runtime.iconOnly) {
|
|
754
1051
|
bar.appendChild(makeCycle(doc));
|
|
755
|
-
if (runtime.mode === "hidden")
|
|
1052
|
+
if (runtime.mode === "hidden") {
|
|
1053
|
+
const all = allButton();
|
|
1054
|
+
if (all) bar.appendChild(all);
|
|
1055
|
+
}
|
|
756
1056
|
return;
|
|
757
1057
|
}
|
|
758
1058
|
if (runtime.model === "header") {
|
|
@@ -761,14 +1061,20 @@ function renderBar() {
|
|
|
761
1061
|
}
|
|
762
1062
|
if (runtime.model === "cycle") {
|
|
763
1063
|
bar.appendChild(makeCycle(doc));
|
|
764
|
-
if (runtime.mode === "hidden")
|
|
1064
|
+
if (runtime.mode === "hidden") {
|
|
1065
|
+
const all = allButton();
|
|
1066
|
+
if (all) bar.appendChild(all);
|
|
1067
|
+
}
|
|
765
1068
|
return;
|
|
766
1069
|
}
|
|
767
1070
|
for (let i = 0; i < MODES.length; i += 1) {
|
|
768
1071
|
const mode = MODES[i];
|
|
769
1072
|
bar.appendChild(makeAction(doc, mode, densityLabel(mode), densityTitle(mode), densityIcon(mode), mode === runtime.mode));
|
|
770
1073
|
}
|
|
771
|
-
if (runtime.mode === "hidden")
|
|
1074
|
+
if (runtime.mode === "hidden") {
|
|
1075
|
+
const all = allButton();
|
|
1076
|
+
if (all) bar.appendChild(all);
|
|
1077
|
+
}
|
|
772
1078
|
}
|
|
773
1079
|
|
|
774
1080
|
/**
|
|
@@ -876,6 +1182,19 @@ function paintNav() {
|
|
|
876
1182
|
if (!nav || typeof nav.setAttribute !== "function") return;
|
|
877
1183
|
try {
|
|
878
1184
|
nav.setAttribute(NAV_ATTR, runtime.mode);
|
|
1185
|
+
nav.setAttribute("data-navfold-cols", runtime.cols);
|
|
1186
|
+
const before = runtime.pinState;
|
|
1187
|
+
const state = applyPin(nav);
|
|
1188
|
+
nav.setAttribute("data-navfold-pinned", state === "applied" ? "on" : state === "nav-only" ? "nav-only" : "off");
|
|
1189
|
+
// 挂起态在下一帧再试一次(抽屉展开动画结束时高度才会非 0)
|
|
1190
|
+
if (state === "pending" && typeof window.setTimeout === "function" && !runtime.pinRetry) {
|
|
1191
|
+
runtime.pinRetry = window.setTimeout(() => {
|
|
1192
|
+
runtime.pinRetry = 0;
|
|
1193
|
+
paintNav();
|
|
1194
|
+
}, 350);
|
|
1195
|
+
}
|
|
1196
|
+
// 找不到工作区标题行时只固定导航:记一次,避免每次重扫刷屏
|
|
1197
|
+
if (state === "nav-only" && before !== "nav-only") noteAnomaly("未找到工作区标题行,仅固定导航区");
|
|
879
1198
|
} catch (err) {
|
|
880
1199
|
warn("写入档位失败", err);
|
|
881
1200
|
}
|
|
@@ -994,6 +1313,164 @@ function getModel() {
|
|
|
994
1313
|
return runtime.model;
|
|
995
1314
|
}
|
|
996
1315
|
|
|
1316
|
+
/** 落盘一个键(失败不影响功能)。 */
|
|
1317
|
+
function persist(key, value) {
|
|
1318
|
+
try {
|
|
1319
|
+
window.localStorage.setItem(key, value);
|
|
1320
|
+
} catch (err) {
|
|
1321
|
+
/* 隐私模式:本次会话内有效即可 */
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
/** 只重置控件样式(不动档位、自动档与保留行)。 */
|
|
1326
|
+
function resetModelOnly() {
|
|
1327
|
+
const previous = runtime.model;
|
|
1328
|
+
runtime.model = "segmented";
|
|
1329
|
+
if (previous !== "segmented") reconcileHeaderMode("segmented");
|
|
1330
|
+
persist(STORAGE_MODEL, runtime.model);
|
|
1331
|
+
runtime.signature = "";
|
|
1332
|
+
paintNav();
|
|
1333
|
+
if (runtime.nav) mountBar(runtime.nav);
|
|
1334
|
+
notify();
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
/** 读取图标档列数。 */
|
|
1338
|
+
function getCols() {
|
|
1339
|
+
return runtime.cols;
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* 设置图标档列数。
|
|
1344
|
+
* @param value - auto / 8 / 7 / 6 / 5 / 4。
|
|
1345
|
+
*/
|
|
1346
|
+
function setCols(value) {
|
|
1347
|
+
runtime.cols = resolveCols(typeof value === "number" ? String(value) : value);
|
|
1348
|
+
persist(STORAGE_COLS, runtime.cols);
|
|
1349
|
+
paintNav();
|
|
1350
|
+
notify();
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
/** 读取图标档吸附开关。 */
|
|
1354
|
+
function getStickCompact() {
|
|
1355
|
+
return runtime.stickCompact;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
/**
|
|
1359
|
+
* 图标档吸附开关。
|
|
1360
|
+
* @param value - 是否吸附。
|
|
1361
|
+
*/
|
|
1362
|
+
function setStickCompact(value) {
|
|
1363
|
+
runtime.stickCompact = !!value;
|
|
1364
|
+
persist(STORAGE_STICK_COMPACT, runtime.stickCompact ? "on" : "off");
|
|
1365
|
+
paintNav();
|
|
1366
|
+
notify();
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
/** 读取收起档吸附开关。 */
|
|
1370
|
+
function getStickHidden() {
|
|
1371
|
+
return runtime.stickHidden;
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
/**
|
|
1375
|
+
* 收起档吸附开关。
|
|
1376
|
+
* @param value - 是否吸附。
|
|
1377
|
+
*/
|
|
1378
|
+
function setStickHidden(value) {
|
|
1379
|
+
runtime.stickHidden = !!value;
|
|
1380
|
+
persist(STORAGE_STICK_HIDDEN, runtime.stickHidden ? "on" : "off");
|
|
1381
|
+
paintNav();
|
|
1382
|
+
notify();
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
/** 读取「外壳已有更多时隐藏我的全部入口」。 */
|
|
1386
|
+
function getHideAllWhenShellMore() {
|
|
1387
|
+
return runtime.hideAllWhenShellMore;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* 「外壳已有更多时隐藏我的全部入口」开关。
|
|
1392
|
+
* @param value - 是否隐藏。
|
|
1393
|
+
*/
|
|
1394
|
+
function setHideAllWhenShellMore(value) {
|
|
1395
|
+
runtime.hideAllWhenShellMore = !!value;
|
|
1396
|
+
persist(STORAGE_SHELL_MORE, runtime.hideAllWhenShellMore ? "on" : "off");
|
|
1397
|
+
runtime.signature = "";
|
|
1398
|
+
renderBar();
|
|
1399
|
+
notify();
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
/** 图标档按当前侧栏宽度算出的每列像素(拿不到宽度返回 0)。 */
|
|
1403
|
+
function columnWidth() {
|
|
1404
|
+
const nav = runtime.nav;
|
|
1405
|
+
if (!nav) return 0;
|
|
1406
|
+
const width = typeof nav.clientWidth === "number" ? nav.clientWidth : 0;
|
|
1407
|
+
const cols = runtime.cols === "auto" ? 0 : Number(runtime.cols);
|
|
1408
|
+
if (!cols || !width) return 0;
|
|
1409
|
+
return (width - (cols - 1) * 2) / cols;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
/** 诊断信息(设置面板展示 + 可复制)。 */
|
|
1413
|
+
function diagnosticsText() {
|
|
1414
|
+
const ua = typeof navigator !== "undefined" && navigator && navigator.userAgent ? navigator.userAgent : "n/a";
|
|
1415
|
+
const latest = runtime.anomalies && runtime.anomalies[0];
|
|
1416
|
+
const warnAt = latest ? new Date(latest.at).toLocaleString() + " · " + latest.kind : "—";
|
|
1417
|
+
const pinText =
|
|
1418
|
+
runtime.pinState === "applied"
|
|
1419
|
+
? "已应用(" + runtime.mode + "档)· 底色 " + (runtime.pinBg || "transparent")
|
|
1420
|
+
: runtime.pinState === "nav-only"
|
|
1421
|
+
? "仅固定导航(未找到工作区标题行)· 底色 " + (runtime.pinBg || "transparent")
|
|
1422
|
+
: runtime.pinState === "pending"
|
|
1423
|
+
? "待定(侧栏当前不可见,展开后自动固定)"
|
|
1424
|
+
: "未启用";
|
|
1425
|
+
return [
|
|
1426
|
+
"dsh-nav-fold " + PLUGIN_VERSION,
|
|
1427
|
+
"状态 " + (latest ? "异常" : "无异常"),
|
|
1428
|
+
"最近告警 " + warnAt,
|
|
1429
|
+
"固定状态 " + pinText,
|
|
1430
|
+
"结构版本 " + (runtime.structure === "wrapped" ? "rc.2+(包裹行 div.panelEntry)" : runtime.structure === "flat" ? "rc.1 及更早(扁平行)" : "未知"),
|
|
1431
|
+
"入口行数 " + runtime.totals.total,
|
|
1432
|
+
"当前档位 " + runtime.mode + " / 控件样式 " + runtime.model,
|
|
1433
|
+
"固定开关 图标档 " + (runtime.stickCompact ? "开" : "关") + ",收起档 " + (runtime.stickHidden ? "开" : "关"),
|
|
1434
|
+
"列数 " + runtime.cols + (runtime.cols === "auto" ? "(自适应)" : ""),
|
|
1435
|
+
"外壳自带入口管理 " + (runtime.shellHasMore ? "是" : "否"),
|
|
1436
|
+
"UA " + ua
|
|
1437
|
+
].join("\n");
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
/** 诊断区是否展开。 */
|
|
1441
|
+
function getDiagOpen() {
|
|
1442
|
+
return runtime.diagOpen;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
/** 展开 / 收起诊断区。 */
|
|
1446
|
+
function toggleDiag() {
|
|
1447
|
+
runtime.diagOpen = !runtime.diagOpen;
|
|
1448
|
+
notify();
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
/** 复制诊断信息到剪贴板(失败时退回提示)。 */
|
|
1452
|
+
function copyDiagnostics() {
|
|
1453
|
+
const text = diagnosticsText();
|
|
1454
|
+
try {
|
|
1455
|
+
if (typeof navigator !== "undefined" && navigator.clipboard && typeof navigator.clipboard.writeText === "function") {
|
|
1456
|
+
navigator.clipboard.writeText(text);
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
} catch (err) {
|
|
1460
|
+
/* 落到下面 */
|
|
1461
|
+
}
|
|
1462
|
+
try {
|
|
1463
|
+
const area = document.createElement("textarea");
|
|
1464
|
+
area.value = text;
|
|
1465
|
+
document.body.appendChild(area);
|
|
1466
|
+
area.select();
|
|
1467
|
+
document.execCommand("copy");
|
|
1468
|
+
document.body.removeChild(area);
|
|
1469
|
+
} catch (err) {
|
|
1470
|
+
warn("复制诊断信息失败", err);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
|
|
997
1474
|
/**
|
|
998
1475
|
* 订阅状态变化。
|
|
999
1476
|
* @param listener - 变化回调。
|
|
@@ -1039,20 +1516,28 @@ function scan() {
|
|
|
1039
1516
|
return;
|
|
1040
1517
|
}
|
|
1041
1518
|
runtime.headerDrift = 0;
|
|
1519
|
+
runtime.structure = detectStructure(nav);
|
|
1520
|
+
runtime.shellHasMore = detectShellMore(nav);
|
|
1521
|
+
retargetObserver(nav.parentElement || nav);
|
|
1042
1522
|
paintNav();
|
|
1043
1523
|
mountBar(nav);
|
|
1044
1524
|
return;
|
|
1045
1525
|
}
|
|
1046
1526
|
const found = findNav(document);
|
|
1047
1527
|
if (!found) {
|
|
1528
|
+
retargetObserver(document.documentElement || document.body);
|
|
1048
1529
|
if (!runtime.warned && Date.now() - runtime.mountedAt > WARN_AFTER_MS) {
|
|
1049
1530
|
runtime.warned = true;
|
|
1531
|
+
noteAnomaly("未找到「功能入口」导航(DSH 版本可能已变更)");
|
|
1050
1532
|
warn("未找到「功能入口」导航(DSH 版本可能已变更),保持原生 UI " + describeNavs(document));
|
|
1051
1533
|
}
|
|
1052
1534
|
return;
|
|
1053
1535
|
}
|
|
1054
1536
|
runtime.nav = found;
|
|
1055
1537
|
runtime.warned = false;
|
|
1538
|
+
runtime.structure = detectStructure(found);
|
|
1539
|
+
runtime.shellHasMore = detectShellMore(found);
|
|
1540
|
+
retargetObserver(found.parentElement || found);
|
|
1056
1541
|
paintNav();
|
|
1057
1542
|
mountBar(found);
|
|
1058
1543
|
}
|
|
@@ -1276,7 +1761,17 @@ function resetAll() {
|
|
|
1276
1761
|
/* 忽略 */
|
|
1277
1762
|
}
|
|
1278
1763
|
try {
|
|
1279
|
-
[
|
|
1764
|
+
[
|
|
1765
|
+
STORAGE_MODE,
|
|
1766
|
+
STORAGE_MODE_NARROW,
|
|
1767
|
+
STORAGE_MODEL,
|
|
1768
|
+
STORAGE_AUTO,
|
|
1769
|
+
STORAGE_KEEP,
|
|
1770
|
+
STORAGE_COLS,
|
|
1771
|
+
STORAGE_STICK_COMPACT,
|
|
1772
|
+
STORAGE_STICK_HIDDEN,
|
|
1773
|
+
STORAGE_SHELL_MORE
|
|
1774
|
+
].forEach((key) => {
|
|
1280
1775
|
window.localStorage.removeItem(key);
|
|
1281
1776
|
});
|
|
1282
1777
|
} catch (err) {
|
|
@@ -1285,6 +1780,10 @@ function resetAll() {
|
|
|
1285
1780
|
runtime.keep = [];
|
|
1286
1781
|
runtime.model = "segmented";
|
|
1287
1782
|
runtime.auto = true;
|
|
1783
|
+
runtime.cols = "auto";
|
|
1784
|
+
runtime.stickCompact = true;
|
|
1785
|
+
runtime.stickHidden = false;
|
|
1786
|
+
runtime.hideAllWhenShellMore = true;
|
|
1288
1787
|
runtime.mode = pickInitialMode(null, runtime.narrow, window.innerHeight, true);
|
|
1289
1788
|
if (runtime.nav) syncKeeps(runtime.nav);
|
|
1290
1789
|
paintNav();
|
|
@@ -1374,6 +1873,27 @@ function followViewport(media) {
|
|
|
1374
1873
|
* 绑定 DOM:首扫 + 外壳重挂/重渲染时重挂控制条(节流),卸载时清理干净。
|
|
1375
1874
|
* @returns 清理函数。
|
|
1376
1875
|
*/
|
|
1876
|
+
/**
|
|
1877
|
+
* 把观察器挪到指定节点:找得到 nav 时只盯侧栏容器,找不到时退回全文档。
|
|
1878
|
+
* @param target - 观察目标。
|
|
1879
|
+
*/
|
|
1880
|
+
function retargetObserver(target) {
|
|
1881
|
+
if (!runtime.observer || !target) return;
|
|
1882
|
+
if (runtime.observedTarget === target) return;
|
|
1883
|
+
try {
|
|
1884
|
+
runtime.observer.disconnect();
|
|
1885
|
+
runtime.observer.observe(target, {
|
|
1886
|
+
childList: true,
|
|
1887
|
+
subtree: true,
|
|
1888
|
+
attributes: true,
|
|
1889
|
+
attributeFilter: ["data-sidebar-collapsed"]
|
|
1890
|
+
});
|
|
1891
|
+
runtime.observedTarget = target;
|
|
1892
|
+
} catch (err) {
|
|
1893
|
+
/* 观察失败不影响主流程,下一次 scan 会重试 */
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1377
1897
|
function attachDom() {
|
|
1378
1898
|
const schedule = () => {
|
|
1379
1899
|
if (runtime.timer) return;
|
|
@@ -1400,14 +1920,17 @@ function attachDom() {
|
|
|
1400
1920
|
if (own) return;
|
|
1401
1921
|
schedule();
|
|
1402
1922
|
});
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1923
|
+
retargetObserver(document.documentElement || document.body);
|
|
1924
|
+
// 兜底:容器整体被替换时观察器盯的是已脱离文档的节点,只能靠低频查 isConnected
|
|
1925
|
+
if (typeof window.setInterval === "function") {
|
|
1926
|
+
runtime.poll = window.setInterval(() => {
|
|
1927
|
+
if (!runtime.nav || runtime.nav.isConnected !== false) return;
|
|
1928
|
+
runtime.nav = null;
|
|
1929
|
+
runtime.warned = false;
|
|
1930
|
+
noteAnomaly("侧栏容器被整体替换,已自动重挂");
|
|
1931
|
+
retargetObserver(document.documentElement || document.body);
|
|
1932
|
+
scan();
|
|
1933
|
+
}, 2000);
|
|
1411
1934
|
}
|
|
1412
1935
|
}
|
|
1413
1936
|
const Resize = window.ResizeObserver;
|
|
@@ -1424,6 +1947,14 @@ function attachDom() {
|
|
|
1424
1947
|
}
|
|
1425
1948
|
runtime.observer = null;
|
|
1426
1949
|
}
|
|
1950
|
+
if (runtime.poll) {
|
|
1951
|
+
window.clearInterval(runtime.poll);
|
|
1952
|
+
runtime.poll = 0;
|
|
1953
|
+
}
|
|
1954
|
+
if (runtime.observer) {
|
|
1955
|
+
runtime.observer.disconnect();
|
|
1956
|
+
runtime.observedTarget = null;
|
|
1957
|
+
}
|
|
1427
1958
|
if (runtime.resize) {
|
|
1428
1959
|
try {
|
|
1429
1960
|
runtime.resize.disconnect();
|
|
@@ -1507,9 +2038,19 @@ const PANEL_CSS = {
|
|
|
1507
2038
|
foot: {
|
|
1508
2039
|
display: "flex",
|
|
1509
2040
|
justifyContent: "flex-end",
|
|
2041
|
+
gap: 8,
|
|
1510
2042
|
paddingTop: 10,
|
|
1511
2043
|
borderTop: "1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.08))"
|
|
1512
|
-
}
|
|
2044
|
+
},
|
|
2045
|
+
diagToggle: {
|
|
2046
|
+
padding: "2px 6px",
|
|
2047
|
+
border: "none",
|
|
2048
|
+
background: "transparent",
|
|
2049
|
+
color: "var(--dsw-alias-label-secondary,#666)",
|
|
2050
|
+
fontSize: 12,
|
|
2051
|
+
cursor: "pointer"
|
|
2052
|
+
},
|
|
2053
|
+
diag: { margin: 0 }
|
|
1513
2054
|
};
|
|
1514
2055
|
|
|
1515
2056
|
/**
|
|
@@ -1549,6 +2090,51 @@ function NavFoldSettings() {
|
|
|
1549
2090
|
const keepSnapshot = () =>
|
|
1550
2091
|
runtime.keep.map((entry) => entry.i + ":" + entry.label).join("|") + "#" + runtime.totals.total + "#" + (runtime.confirmReset ? "c" : "");
|
|
1551
2092
|
react.useSyncExternalStore(subscribe, keepSnapshot, keepSnapshot);
|
|
2093
|
+
const cols = react.useSyncExternalStore(subscribe, getCols, getCols);
|
|
2094
|
+
const stickCompact = react.useSyncExternalStore(subscribe, getStickCompact, getStickCompact);
|
|
2095
|
+
const stickHidden = react.useSyncExternalStore(subscribe, getStickHidden, getStickHidden);
|
|
2096
|
+
const shellMore = react.useSyncExternalStore(subscribe, getHideAllWhenShellMore, getHideAllWhenShellMore);
|
|
2097
|
+
const diagOpen = react.useSyncExternalStore(subscribe, getDiagOpen, getDiagOpen);
|
|
2098
|
+
const cellsTitleId = uid + "-cells";
|
|
2099
|
+
const iconStickId = uid + "-stick-icon";
|
|
2100
|
+
const hiddenStickId = uid + "-stick-hidden";
|
|
2101
|
+
const shellId = uid + "-shell";
|
|
2102
|
+
const diagId = uid + "-diag";
|
|
2103
|
+
// 列数挤压提示:按当前侧栏实宽算每列像素,低于阈值就提示(不阻断)
|
|
2104
|
+
const navWidth = runtime.nav && typeof runtime.nav.clientWidth === "number" ? runtime.nav.clientWidth : 0;
|
|
2105
|
+
const colsNum = cols === "auto" ? 0 : Number(cols);
|
|
2106
|
+
const perCol = colsNum && navWidth ? (navWidth - (colsNum - 1) * 2) / colsNum : 0;
|
|
2107
|
+
const mobileWidth =
|
|
2108
|
+
typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(NARROW_QUERY).matches : false;
|
|
2109
|
+
const cramped = colsNum > 0 && perCol > 0 && perCol < COL_MIN_PX;
|
|
2110
|
+
const mobileTight = mobileWidth && colsNum >= 7;
|
|
2111
|
+
const makeWarn = () =>
|
|
2112
|
+
cramped || mobileTight
|
|
2113
|
+
? el(
|
|
2114
|
+
"p",
|
|
2115
|
+
{ "data-navfold-warn": "" },
|
|
2116
|
+
mobileTight
|
|
2117
|
+
? t("settings.cells.warnMobile")
|
|
2118
|
+
: t("settings.cells.warn", { width: Math.round(navWidth), cols: colsNum, px: Math.round(perCol) }),
|
|
2119
|
+
el("button", { type: "button", onClick: () => setCols("auto") }, t("settings.cells.revert"))
|
|
2120
|
+
)
|
|
2121
|
+
: null;
|
|
2122
|
+
const switchOf = (checked, ids, onToggle, attrs) =>
|
|
2123
|
+
el(
|
|
2124
|
+
"button",
|
|
2125
|
+
Object.assign(
|
|
2126
|
+
{
|
|
2127
|
+
type: "button",
|
|
2128
|
+
role: "switch",
|
|
2129
|
+
"aria-checked": checked ? "true" : "false",
|
|
2130
|
+
"aria-labelledby": ids,
|
|
2131
|
+
"data-navfold-switch": "",
|
|
2132
|
+
onClick: onToggle
|
|
2133
|
+
},
|
|
2134
|
+
attrs || {}
|
|
2135
|
+
),
|
|
2136
|
+
el("span", { "aria-hidden": "true" })
|
|
2137
|
+
);
|
|
1552
2138
|
|
|
1553
2139
|
const rows = collectRows(runtime.nav || null);
|
|
1554
2140
|
const keepIndices = new Set(resolveKeepIndices(rows).map((item) => item.index));
|
|
@@ -1621,6 +2207,7 @@ function NavFoldSettings() {
|
|
|
1621
2207
|
"aria-checked": auto ? "true" : "false",
|
|
1622
2208
|
"aria-labelledby": autoTitleId,
|
|
1623
2209
|
"data-navfold-auto": auto ? "on" : "off",
|
|
2210
|
+
"data-navfold-switch": "",
|
|
1624
2211
|
onClick: () => setAuto(!auto)
|
|
1625
2212
|
},
|
|
1626
2213
|
el("span", { "aria-hidden": "true" })
|
|
@@ -1675,10 +2262,98 @@ function NavFoldSettings() {
|
|
|
1675
2262
|
),
|
|
1676
2263
|
el("p", { style: PANEL_CSS.desc }, t("settings.keep.hint"))
|
|
1677
2264
|
),
|
|
2265
|
+
// 图标档:每行几个 + 吸附
|
|
2266
|
+
el(
|
|
2267
|
+
"section",
|
|
2268
|
+
{ style: PANEL_CSS.group, role: "group", "aria-labelledby": cellsTitleId },
|
|
2269
|
+
el(
|
|
2270
|
+
"div",
|
|
2271
|
+
{ style: PANEL_CSS.row },
|
|
2272
|
+
el("span", { id: cellsTitleId, style: PANEL_CSS.title, key: "t" }, t("settings.cells.title")),
|
|
2273
|
+
el(
|
|
2274
|
+
"div",
|
|
2275
|
+
{ style: PANEL_CSS.seg, role: "radiogroup", "aria-labelledby": cellsTitleId, key: "g" },
|
|
2276
|
+
COLS_OPTIONS.map((value) =>
|
|
2277
|
+
el(
|
|
2278
|
+
"button",
|
|
2279
|
+
{
|
|
2280
|
+
key: value,
|
|
2281
|
+
type: "button",
|
|
2282
|
+
role: "radio",
|
|
2283
|
+
"aria-checked": cols === value ? "true" : "false",
|
|
2284
|
+
"data-navfold-cols-btn": value,
|
|
2285
|
+
onClick: () => setCols(value),
|
|
2286
|
+
style: PANEL_CSS.segBtn
|
|
2287
|
+
},
|
|
2288
|
+
value === "auto" ? t("settings.cells.auto") : value
|
|
2289
|
+
)
|
|
2290
|
+
)
|
|
2291
|
+
)
|
|
2292
|
+
),
|
|
2293
|
+
makeWarn(),
|
|
2294
|
+
el("p", { style: PANEL_CSS.desc }, t("settings.cells.desc")),
|
|
2295
|
+
el(
|
|
2296
|
+
"div",
|
|
2297
|
+
{ style: PANEL_CSS.row },
|
|
2298
|
+
el("span", { id: iconStickId, style: PANEL_CSS.title, key: "t2" }, t("settings.stick.title")),
|
|
2299
|
+
switchOf(stickCompact, iconStickId, () => setStickCompact(!stickCompact), { "data-navfold-stick": "compact" })
|
|
2300
|
+
),
|
|
2301
|
+
el("p", { style: PANEL_CSS.desc }, t("settings.stick.compact.desc"))
|
|
2302
|
+
),
|
|
2303
|
+
// 收起档:吸附(默认关)
|
|
2304
|
+
el(
|
|
2305
|
+
"section",
|
|
2306
|
+
{ style: PANEL_CSS.group, role: "group", "aria-labelledby": hiddenStickId },
|
|
2307
|
+
el(
|
|
2308
|
+
"div",
|
|
2309
|
+
{ style: PANEL_CSS.row },
|
|
2310
|
+
el("span", { id: hiddenStickId, style: PANEL_CSS.title, key: "t" }, t("settings.stick.title")),
|
|
2311
|
+
switchOf(stickHidden, hiddenStickId, () => setStickHidden(!stickHidden), { "data-navfold-stick": "hidden" })
|
|
2312
|
+
),
|
|
2313
|
+
el("p", { style: PANEL_CSS.desc }, t("settings.stick.hidden.desc"))
|
|
2314
|
+
),
|
|
2315
|
+
// 与外壳共存
|
|
2316
|
+
el(
|
|
2317
|
+
"section",
|
|
2318
|
+
{ style: PANEL_CSS.group, role: "group", "aria-labelledby": shellId },
|
|
2319
|
+
el(
|
|
2320
|
+
"div",
|
|
2321
|
+
{ style: PANEL_CSS.row },
|
|
2322
|
+
el("span", { id: shellId, style: PANEL_CSS.title, key: "t" }, t("settings.shell.title")),
|
|
2323
|
+
switchOf(shellMore, shellId, () => setHideAllWhenShellMore(!shellMore), { "data-navfold-shell-more": shellMore ? "on" : "off" })
|
|
2324
|
+
),
|
|
2325
|
+
el("p", { style: PANEL_CSS.desc }, t("settings.shell.desc"))
|
|
2326
|
+
),
|
|
1678
2327
|
el("p", { style: PANEL_CSS.desc }, t("settings.rail.hint")),
|
|
2328
|
+
// 诊断(默认折叠)
|
|
2329
|
+
el(
|
|
2330
|
+
"section",
|
|
2331
|
+
{ style: PANEL_CSS.group, role: "group", "aria-labelledby": diagId },
|
|
2332
|
+
el(
|
|
2333
|
+
"div",
|
|
2334
|
+
{ style: PANEL_CSS.row },
|
|
2335
|
+
el(
|
|
2336
|
+
"button",
|
|
2337
|
+
{
|
|
2338
|
+
id: diagId,
|
|
2339
|
+
type: "button",
|
|
2340
|
+
"aria-expanded": diagOpen ? "true" : "false",
|
|
2341
|
+
"data-navfold-diag-toggle": "",
|
|
2342
|
+
onClick: toggleDiag,
|
|
2343
|
+
style: PANEL_CSS.diagToggle
|
|
2344
|
+
},
|
|
2345
|
+
(diagOpen ? "▾ " : "▸ ") + t("settings.diag.title")
|
|
2346
|
+
),
|
|
2347
|
+
diagOpen
|
|
2348
|
+
? el("button", { type: "button", "data-navfold-micro": "copy", onClick: copyDiagnostics }, t("settings.diag.copy"))
|
|
2349
|
+
: null
|
|
2350
|
+
),
|
|
2351
|
+
diagOpen ? el("pre", { "data-navfold-diag": "", style: PANEL_CSS.diag }, diagnosticsText()) : null
|
|
2352
|
+
),
|
|
1679
2353
|
el(
|
|
1680
2354
|
"div",
|
|
1681
2355
|
{ style: PANEL_CSS.foot },
|
|
2356
|
+
el("button", { type: "button", "data-navfold-reset-model": "on", onClick: resetModelOnly }, t("settings.resetModel")),
|
|
1682
2357
|
el(
|
|
1683
2358
|
"button",
|
|
1684
2359
|
{
|
|
@@ -1713,13 +2388,15 @@ function wireLocale(ctx) {
|
|
|
1713
2388
|
if (typeof locale.bind !== "function") return;
|
|
1714
2389
|
try {
|
|
1715
2390
|
const bound = locale.bind(NS);
|
|
2391
|
+
// 缺词条时的兜底语言:中文环境用中文,其它语言用英文(DSH 还支持 ja/de/fr/es/pt/ru,回退中文会中英混排)
|
|
2392
|
+
const lang = (document.documentElement && document.documentElement.lang) || "";
|
|
2393
|
+
const fallback = /^zh/i.test(lang) ? DICT.zh : DICT.en;
|
|
1716
2394
|
t = (key, params) => {
|
|
1717
2395
|
try {
|
|
1718
2396
|
const value = bound(key, params);
|
|
1719
|
-
|
|
1720
|
-
return typeof value === "string" && value.length > 0 && value !== key ? value : formatText(dictText(DICT.zh, key), params);
|
|
2397
|
+
return typeof value === "string" && value.length > 0 && value !== key ? value : formatText(dictText(fallback, key), params);
|
|
1721
2398
|
} catch (err) {
|
|
1722
|
-
return formatText(dictText(
|
|
2399
|
+
return formatText(dictText(fallback, key), params);
|
|
1723
2400
|
}
|
|
1724
2401
|
};
|
|
1725
2402
|
} catch (err) {
|
|
@@ -1785,19 +2462,35 @@ function apply(ctx) {
|
|
|
1785
2462
|
let storedModel = null;
|
|
1786
2463
|
let storedAuto = null;
|
|
1787
2464
|
let storedKeep = null;
|
|
2465
|
+
let storedCols = null;
|
|
2466
|
+
let storedStickCompact = null;
|
|
2467
|
+
let storedStickHidden = null;
|
|
2468
|
+
let storedShellMore = null;
|
|
1788
2469
|
try {
|
|
1789
2470
|
storedMode = window.localStorage.getItem(modeKey(runtime.narrow));
|
|
1790
2471
|
storedModel = window.localStorage.getItem(STORAGE_MODEL);
|
|
1791
2472
|
storedAuto = window.localStorage.getItem(STORAGE_AUTO);
|
|
1792
2473
|
storedKeep = window.localStorage.getItem(STORAGE_KEEP);
|
|
2474
|
+
storedCols = window.localStorage.getItem(STORAGE_COLS);
|
|
2475
|
+
storedStickCompact = window.localStorage.getItem(STORAGE_STICK_COMPACT);
|
|
2476
|
+
storedStickHidden = window.localStorage.getItem(STORAGE_STICK_HIDDEN);
|
|
2477
|
+
storedShellMore = window.localStorage.getItem(STORAGE_SHELL_MORE);
|
|
1793
2478
|
} catch (err) {
|
|
1794
2479
|
storedMode = null;
|
|
1795
2480
|
storedModel = null;
|
|
1796
2481
|
storedAuto = null;
|
|
1797
2482
|
storedKeep = null;
|
|
2483
|
+
storedCols = null;
|
|
2484
|
+
storedStickCompact = null;
|
|
2485
|
+
storedStickHidden = null;
|
|
2486
|
+
storedShellMore = null;
|
|
1798
2487
|
}
|
|
1799
2488
|
runtime.keep = resolveKeep(storedKeep);
|
|
1800
2489
|
runtime.auto = resolveAuto(storedAuto);
|
|
2490
|
+
runtime.cols = resolveCols(storedCols);
|
|
2491
|
+
runtime.stickCompact = resolveFlag(storedStickCompact, true);
|
|
2492
|
+
runtime.stickHidden = resolveFlag(storedStickHidden, false);
|
|
2493
|
+
runtime.hideAllWhenShellMore = resolveFlag(storedShellMore, true);
|
|
1801
2494
|
wireLocale(ctx);
|
|
1802
2495
|
runtime.model = resolveModel(storedModel);
|
|
1803
2496
|
runtime.mode = pickInitialMode(storedMode, runtime.narrow, window.innerHeight, runtime.auto);
|
|
@@ -1876,7 +2569,20 @@ exports.__internals = {
|
|
|
1876
2569
|
getModel: getModel,
|
|
1877
2570
|
NavFoldSettings: NavFoldSettings,
|
|
1878
2571
|
runtime: runtime,
|
|
1879
|
-
scan: scan
|
|
2572
|
+
scan: scan,
|
|
2573
|
+
getCols: getCols,
|
|
2574
|
+
setCols,
|
|
2575
|
+
getStickCompact,
|
|
2576
|
+
setStickCompact,
|
|
2577
|
+
getStickHidden,
|
|
2578
|
+
setStickHidden,
|
|
2579
|
+
getHideAllWhenShellMore,
|
|
2580
|
+
setHideAllWhenShellMore,
|
|
2581
|
+
getDiagOpen,
|
|
2582
|
+
toggleDiag,
|
|
2583
|
+
resetModelOnly,
|
|
2584
|
+
diagnosticsText,
|
|
2585
|
+
COLS_OPTIONS
|
|
1880
2586
|
};
|
|
1881
2587
|
return module.exports;
|
|
1882
2588
|
}
|