@twinsearth/dsh-fang 3.1.19 → 3.1.20
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/client.js +19 -4
- package/package.json +1 -1
- package/src/kernel/types.mjs +1 -1
package/client.js
CHANGED
|
@@ -6421,20 +6421,31 @@ window.__ModuleLoader__.load({
|
|
|
6421
6421
|
const NAV_TEXTS = ['插件']
|
|
6422
6422
|
const ACTION_TEXTS = ['启动', '启动插件', '开始使用', '启用']
|
|
6423
6423
|
|
|
6424
|
+
/** v3.1.20:宿主侧栏行类名会随版本变化,不再只认 panelRow。 */
|
|
6424
6425
|
const isPanelRow = (node) => {
|
|
6425
6426
|
try {
|
|
6426
6427
|
if (!node || node.tagName !== 'BUTTON') return false
|
|
6427
6428
|
const cls = String(node.className || '')
|
|
6428
|
-
|
|
6429
|
+
if (/panelRow/i.test(cls)) return true
|
|
6430
|
+
// 兜底:侧栏/导航容器内的按钮
|
|
6431
|
+
return Boolean(node.closest('nav, aside, [class*="sidebar"], [class*="sideBar"], [class*="sider"]'))
|
|
6429
6432
|
} catch { return false }
|
|
6430
6433
|
}
|
|
6431
6434
|
|
|
6435
|
+
/** 插件入口的文本判定(中英 + 少量变体),容忍零宽字符与多余空白。 */
|
|
6436
|
+
const isPluginNavText = (text) => {
|
|
6437
|
+
const clean = String(text || '').replace(/[\u200b-\u200d\ufeff]/g, '').replace(/\s+/g, ' ').trim()
|
|
6438
|
+
if (!clean) return false
|
|
6439
|
+
if (clean === '插件' || clean === 'Plugins' || clean === 'Plugin') return true
|
|
6440
|
+
// 「插件」后面可能跟计数徽标,例如「插件 3」
|
|
6441
|
+
return /^插件(\s|$)/.test(clean) || /^Plugins?(\s|$)/.test(clean)
|
|
6442
|
+
}
|
|
6443
|
+
|
|
6432
6444
|
const hidePluginNav = () => {
|
|
6433
6445
|
if (disposed || !active) return
|
|
6434
6446
|
for (const node of doc.querySelectorAll('button')) {
|
|
6435
6447
|
if (!isPanelRow(node)) continue
|
|
6436
|
-
|
|
6437
|
-
if (!NAV_TEXTS.includes(text)) continue
|
|
6448
|
+
if (!isPluginNavText(node.textContent)) continue
|
|
6438
6449
|
if (node.dataset.fangForkHidden === '1' && node.hidden) continue
|
|
6439
6450
|
node.dataset.fangForkHidden = '1'
|
|
6440
6451
|
node.hidden = true
|
|
@@ -6450,7 +6461,7 @@ window.__ModuleLoader__.load({
|
|
|
6450
6461
|
if (!button) return
|
|
6451
6462
|
const text = String(button.textContent || '').trim()
|
|
6452
6463
|
// ① 侧栏「插件」入口:双重保险(DOM 已隐藏,这里再拦一次点击/键盘激活)
|
|
6453
|
-
if (isPanelRow(button) &&
|
|
6464
|
+
if (isPanelRow(button) && isPluginNavText(text)) {
|
|
6454
6465
|
event.preventDefault()
|
|
6455
6466
|
event.stopPropagation()
|
|
6456
6467
|
event.stopImmediatePropagation()
|
|
@@ -6480,6 +6491,10 @@ window.__ModuleLoader__.load({
|
|
|
6480
6491
|
if (active || disposed) return
|
|
6481
6492
|
active = true
|
|
6482
6493
|
hidePluginNav()
|
|
6494
|
+
try {
|
|
6495
|
+
doc.documentElement?.setAttribute('data-fang-fork-locks', 'applied')
|
|
6496
|
+
window.__fangForkLocks = { applied: true, at: Date.now() }
|
|
6497
|
+
} catch { /* ignore */ }
|
|
6483
6498
|
doc.addEventListener('click', onClickCapture, true)
|
|
6484
6499
|
try {
|
|
6485
6500
|
observer = new MutationObserver(() => { hidePluginNav() })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twinsearth/dsh-fang",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.20",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "dsh-Fang (瓮城) — mother/fork plugin development environment for DeepSeek Harness: one readonly mother, a disposable child dsh-Web per task.",
|