@ggboy123/dsh-paper-reader 1.5.0 → 1.6.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/README.md +6 -5
- package/cordis.patch.yml +73 -0
- package/dist/host.js +2 -13
- package/dist/mineru.js +5 -2
- package/dist/search.js +11 -3
- package/dist/tools.js +1 -1
- package/dist/translate.js +291 -45
- package/lib/client.js +14 -4
- package/package.json +8 -6
- package/reader/index.html +726 -6
- package/runtime/babeldoc-driver.py +379 -0
- package/dist/preset.js +0 -31
- package/presets/paper-reader/agent.cordis.yml +0 -66
- package/presets/paper-reader/preset.yml +0 -3
package/lib/client.js
CHANGED
|
@@ -399,16 +399,23 @@ window.__ModuleLoader__.load({
|
|
|
399
399
|
// (auto-placement 只钉列会重叠/塌行,实测);面板锚列右缘且内联宽度=rightbar
|
|
400
400
|
// 配置宽度,列进窄轨会左溢盖侧栏 → 钉 max-width(⚠️ 不抢 width:dsh 在会话 store
|
|
401
401
|
// 每次提交都重写内联 width,互写同属性 = 持续闪烁,实测)。
|
|
402
|
-
//
|
|
403
|
-
//
|
|
402
|
+
// 钉住条件 = **dpr 页签锚点存在** + 右栏轨宽自判断:右栏折叠(第 3 轨≈0)时撤钉
|
|
403
|
+
// —— 否则 seat 重绑的空窗期 PDF 列会吃掉对话列的宽度,双双消失又出现("整屏闪",实测)。
|
|
404
|
+
// 只看轨宽不够(#10):任何右侧栏页签(官方文件预览/present 卡片)都会撑开第 3 轨,
|
|
405
|
+
// 普通会话里会把对话挤到最右。锚点在 seat 重绑/切换护栏的空窗期会瞬时消失(同下方
|
|
406
|
+
// overlay 测量的暂态),按 lastSeen 加 1500ms(=切换护栏窗口宽)迟滞,免得换位
|
|
407
|
+
// 撤钉又回钉,闪回当初修掉的整屏闪。
|
|
404
408
|
const setStyle = (el, prop, val) => { if (el.style[prop] !== val) el.style[prop] = val }
|
|
409
|
+
let lastPdfTabAt = 0
|
|
405
410
|
const applySwap = () => {
|
|
406
411
|
const col = document.querySelector('[data-rightbar-col]')
|
|
407
412
|
const center = col?.previousElementSibling // DOM 序固定:sidebar | center | rightbar
|
|
408
413
|
const frame = col?.parentElement
|
|
409
414
|
if (!col || !center || !frame) return
|
|
410
415
|
const tracks = getComputedStyle(frame).gridTemplateColumns.split(' ').map(parseFloat)
|
|
411
|
-
const
|
|
416
|
+
const tabEl = document.querySelector('[data-dpr-tab]')
|
|
417
|
+
if (tabEl) lastPdfTabAt = Date.now()
|
|
418
|
+
const eff = (!!tabEl || Date.now() - lastPdfTabAt < 1500) && (tracks[2] ?? 0) >= 50 && !frame.hasAttribute('data-rightbar-fullscreen')
|
|
412
419
|
// 所有写入带值守卫:重复写同值也会触发样式重算,200ms 轮询下会闪
|
|
413
420
|
setStyle(col, 'gridColumn', eff ? '2' : '')
|
|
414
421
|
setStyle(col, 'gridRow', eff ? '1' : '')
|
|
@@ -491,10 +498,13 @@ window.__ModuleLoader__.load({
|
|
|
491
498
|
|
|
492
499
|
/* ---------- rightbar PDF 页签(只剩占位锚点 + 布局换位) ---------- */
|
|
493
500
|
function PdfTab() {
|
|
494
|
-
// 真正的阅读器是 ReaderOverlay 的常驻 iframe
|
|
501
|
+
// 真正的阅读器是 ReaderOverlay 的常驻 iframe;这里只提供定位锚点。
|
|
502
|
+
// data-dpr-tab 标记 = 「dpr 页签在本会话开着」,applySwap 据此判断是否换位(#10:
|
|
503
|
+
// 不能只看右栏轨宽,否则官方文件预览页签也会把对话挤到最右)。
|
|
495
504
|
const hasPaper = !!localStorage.getItem('dpr.last')
|
|
496
505
|
return h('div', {
|
|
497
506
|
'data-dsh-surface': 'rightbar-tab-anchor',
|
|
507
|
+
'data-dpr-tab': '1',
|
|
498
508
|
style: { width: '100%', height: '100%' },
|
|
499
509
|
}, hasPaper ? null : h('div', { style: { padding: '16px', fontSize: '13px', color: 'var(--dsw-alias-label-secondary, #656d76)' } }, '← 从文献库选择一篇论文'))
|
|
500
510
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ggboy123/dsh-paper-reader",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "DeepSeek Harness 插件:论文伴读工作台 — PDF 转录 / 检索 / 原生对话伴读 + 内置阅读器页面。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dist",
|
|
27
27
|
"lib",
|
|
28
28
|
"reader",
|
|
29
|
-
"
|
|
29
|
+
"runtime",
|
|
30
30
|
"cordis.patch.yml"
|
|
31
31
|
],
|
|
32
32
|
"dsh": {
|
|
@@ -43,12 +43,14 @@
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
|
-
"
|
|
46
|
+
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
47
|
+
"build": "npm run clean && tsc -p tsconfig.json",
|
|
47
48
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
48
49
|
"pretest": "npm run build",
|
|
49
50
|
"test": "node --test --test-timeout=60000 --test-concurrency=1 \"test/*.test.mjs\"",
|
|
50
51
|
"smoke:engine": "node scripts/engine-smoke.mjs",
|
|
51
|
-
"
|
|
52
|
+
"release": "node scripts/release.mjs",
|
|
53
|
+
"prepublishOnly": "npm run build"
|
|
52
54
|
},
|
|
53
55
|
"keywords": [
|
|
54
56
|
"dsh-plugin",
|
|
@@ -73,11 +75,11 @@
|
|
|
73
75
|
},
|
|
74
76
|
"peerDependencies": {
|
|
75
77
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
76
|
-
"@deepseek-ai/dsh-tools": ">=0.
|
|
78
|
+
"@deepseek-ai/dsh-tools": ">=0.2.0-rc.2 <0.3.0-0"
|
|
77
79
|
},
|
|
78
80
|
"devDependencies": {
|
|
79
81
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
80
|
-
"@deepseek-ai/dsh-tools": "0.
|
|
82
|
+
"@deepseek-ai/dsh-tools": "0.2.0-rc.2",
|
|
81
83
|
"@types/node": "^22.10.0",
|
|
82
84
|
"typescript": "^5.6.0"
|
|
83
85
|
}
|