dsh-seal-scripts 0.6.1 → 0.6.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/README.en.md +226 -231
- package/README.md +108 -106
- package/lib/client.js +215 -32
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -1304,16 +1304,12 @@ window.__ModuleLoader__.load({
|
|
|
1304
1304
|
return value === undefined ? key : value
|
|
1305
1305
|
}
|
|
1306
1306
|
|
|
1307
|
-
//
|
|
1308
|
-
//
|
|
1307
|
+
// 0.6.2:滑条改成插件自绘(见 ScrollBox)。
|
|
1308
|
+
// 原生 ::-webkit-scrollbar 在触屏上根本拖不动:手指按在滑条上既不跟手、也不滚,
|
|
1309
|
+
// 鼠标上去倒是正常 —— 所以把原生滑条整个隐藏,由 pointer 事件自己画、自己拖。
|
|
1309
1310
|
var SCROLL_CSS = [
|
|
1310
|
-
'.
|
|
1311
|
-
'.
|
|
1312
|
-
'.recall-scroll::-webkit-scrollbar-button { display: none; width: 0; height: 0; }',
|
|
1313
|
-
'.recall-scroll::-webkit-scrollbar-track { background: transparent; }',
|
|
1314
|
-
'.recall-scroll::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,.38); border-radius: 20px; border: 3px solid transparent; background-clip: content-box; min-height: 48px; }',
|
|
1315
|
-
'.recall-scroll::-webkit-scrollbar-thumb:active { background-color: rgba(0,0,0,.62); }',
|
|
1316
|
-
'.recall-scroll::-webkit-scrollbar-corner { background: transparent; }'
|
|
1311
|
+
'.seal-scroll { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; }',
|
|
1312
|
+
'.seal-scroll::-webkit-scrollbar { width: 0; height: 0; display: none; }'
|
|
1317
1313
|
].join('')
|
|
1318
1314
|
|
|
1319
1315
|
/** 只注入一次;没有 document 的环境直接跳过。 */
|
|
@@ -1331,6 +1327,7 @@ window.__ModuleLoader__.load({
|
|
|
1331
1327
|
// 2. border 简写与 borderColor 不能混用 —— 撤销时 removeProperty 会回退到 currentColor(黑框);
|
|
1332
1328
|
// 所以归档左边条用一个独立的绝对定位子元素画虚线,完全不碰行的 border。
|
|
1333
1329
|
var S = {
|
|
1330
|
+
// 0.6.2:整页只留这一条滑条 —— 插件设置区自己滚,填满宿主内容面板的高度。
|
|
1334
1331
|
wrap: { display: 'flex', flexDirection: 'column', gap: 12, minHeight: 0 },
|
|
1335
1332
|
head: { display: 'flex', alignItems: 'baseline', justifyContent: 'space-between', gap: 10 },
|
|
1336
1333
|
h1: { fontSize: 15, fontWeight: 600 },
|
|
@@ -1339,7 +1336,9 @@ window.__ModuleLoader__.load({
|
|
|
1339
1336
|
tab: { padding: '6px 14px', borderRadius: 8, border: '1px solid transparent', background: 'transparent', cursor: 'pointer', fontSize: 14, color: 'inherit', opacity: 0.62 },
|
|
1340
1337
|
tabOn: { padding: '6px 14px', borderRadius: 8, border: '1px solid #e5e5e5', background: '#f6f6f6', cursor: 'pointer', fontSize: 14, color: 'inherit', opacity: 1, fontWeight: 600 },
|
|
1341
1338
|
ws: { fontSize: 12, opacity: 0.6, margin: '12px 0 6px', fontFamily: 'ui-monospace, monospace' },
|
|
1342
|
-
|
|
1339
|
+
// 0.6.2:会话列表不再各自套一个 42vh 滚动框(每个工作区一条分滑条)。
|
|
1340
|
+
// 整个「会话」页只留 S.page 一个滚动框,列表和下面三颗按钮一起在里面滚。
|
|
1341
|
+
list: { display: 'flex', flexDirection: 'column', gap: 6 },
|
|
1343
1342
|
row: { position: 'relative', display: 'flex', alignItems: 'center', gap: 8, padding: '9px 12px', borderRadius: 10, border: '1px solid #e5e5e5', cursor: 'pointer', fontSize: 13, background: 'transparent', color: 'inherit', textAlign: 'left', width: '100%', boxSizing: 'border-box', outline: 'none', boxShadow: 'none', WebkitTapHighlightColor: 'transparent', userSelect: 'none' },
|
|
1344
1343
|
rowOn: { background: 'rgba(64,120,255,0.12)', border: '1px solid #4078ff' },
|
|
1345
1344
|
leftBar: { position: 'absolute', left: 0, top: 0, bottom: 0, width: 0, borderLeft: '1px dashed #9a9a9a', pointerEvents: 'none' },
|
|
@@ -1349,10 +1348,14 @@ window.__ModuleLoader__.load({
|
|
|
1349
1348
|
muted: { opacity: 0.62 },
|
|
1350
1349
|
badge: { fontSize: 10, padding: '1px 6px', borderRadius: 999, border: '1px dashed #9a9a9a', opacity: 0.8, flex: '0 0 auto' },
|
|
1351
1350
|
footer: { display: 'flex', gap: 10, paddingTop: 12, borderTop: '1px solid #e5e5e5', marginTop: 12 },
|
|
1351
|
+
// 0.6.2:会话页头(导入 / 删除 / 删除并回顾)。原先在页底,要滚到底才够得着。
|
|
1352
|
+
sessionBar: { display: 'flex', gap: 10, flexWrap: 'wrap', paddingBottom: 12, borderBottom: '1px solid #e5e5e5' },
|
|
1352
1353
|
btn: { padding: '8px 16px', borderRadius: 9, border: '1px solid #e5e5e5', background: '#f6f6f6', cursor: 'pointer', fontSize: 13, color: 'inherit' },
|
|
1353
1354
|
btnDanger: { padding: '8px 16px', borderRadius: 9, border: '1px solid #d9534f', background: 'transparent', color: '#d9534f', cursor: 'pointer', fontSize: 13 },
|
|
1354
1355
|
btnOff: { padding: '8px 16px', borderRadius: 9, border: '1px solid #e5e5e5', background: 'transparent', color: 'inherit', opacity: 0.35, cursor: 'not-allowed', fontSize: 13 },
|
|
1355
1356
|
note: { fontSize: 12, opacity: 0.6, minHeight: 18 },
|
|
1357
|
+
// 页脚状态区(0.6.2):回执/报错固定在页底,不再混在正文最后一行。
|
|
1358
|
+
status: { display: 'flex', flexDirection: 'column', gap: 4, paddingTop: 8, borderTop: '1px solid #ececec', marginTop: 6 },
|
|
1356
1359
|
err: { fontSize: 12, color: '#d9534f', minHeight: 18 },
|
|
1357
1360
|
chip: { fontSize: 11, padding: '1px 7px', borderRadius: 999, border: '1px solid #ddd', opacity: 0.85, flex: '0 0 auto' },
|
|
1358
1361
|
// 锁定过的深度用实心蓝底,跟普通灰框一眼分得开(锁定意味着不再衰减)。
|
|
@@ -1372,10 +1375,13 @@ window.__ModuleLoader__.load({
|
|
|
1372
1375
|
disc: { display: 'flex', alignItems: 'center' },
|
|
1373
1376
|
discBtn: { width: '100%', display: 'flex', alignItems: 'center', gap: 8, padding: '10px 12px', borderRadius: 10, border: '1px solid #e5e5e5', background: '#f6f6f6', cursor: 'pointer', fontSize: 13, color: 'inherit', textAlign: 'left', boxSizing: 'border-box', outline: 'none' },
|
|
1374
1377
|
caret: { fontSize: 11, opacity: 0.6, width: 12, flex: '0 0 auto' },
|
|
1375
|
-
|
|
1378
|
+
// 0.6.2:页面级滑条删掉,滚动交给外层 wrap;这里只保证能收缩。
|
|
1379
|
+
page: { minHeight: 0 },
|
|
1376
1380
|
// 选项页内容一屏装得下:不套 60vh 滚动框,右侧就不会多出一道拉条(0.2.1)。
|
|
1377
1381
|
pageFlat: { minHeight: 0 },
|
|
1378
|
-
|
|
1382
|
+
// 0.6.2:右边留 24px,让预览框的滑条和整页滑条之间有一道空隙(两条滑条不再紧贴/重叠)。
|
|
1383
|
+
// 0.6.2:高度上限与外边距交给 ScrollBox 的外层(boxStyle),这里只管字体和配色。
|
|
1384
|
+
preWide: { whiteSpace: 'pre-wrap', wordBreak: 'break-word', fontSize: 12, lineHeight: 1.6, background: '#f8f8f8', border: '1px solid #e5e5e5', borderRadius: 10, padding: 12, fontFamily: 'inherit' },
|
|
1379
1385
|
// 选项页:一组一块,标签在左、开关/下拉在右。
|
|
1380
1386
|
optGroup: { fontSize: 12, opacity: 0.6, paddingBottom: 6, borderBottom: '1px solid #ececec', marginTop: 6 },
|
|
1381
1387
|
optRow: { display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between', gap: 14, padding: '10px 0', borderBottom: '1px solid #f4f4f4' },
|
|
@@ -1385,7 +1391,10 @@ window.__ModuleLoader__.load({
|
|
|
1385
1391
|
// 全量加载开启后整段警示标红:不用 0.62 透明度,红字要压得住。
|
|
1386
1392
|
optDescWarn: { fontSize: 12, lineHeight: 1.55, color: '#d9534f', fontWeight: 600 },
|
|
1387
1393
|
// 「自创工具」页的预览框:等宽、可折行,自己的高度上限里滚,不撑破整页。
|
|
1388
|
-
|
|
1394
|
+
// 0.6.2:margin 不能写成 0,否则会把右侧 24px 的滑条空隙一起覆盖掉。
|
|
1395
|
+
// 0.6.2:同上,maxHeight / marginRight 由 ScrollBox 的 boxStyle 给;
|
|
1396
|
+
// margin 必须显式写 0,否则 pre 的 UA 外边距会把预览框顶下去一截。
|
|
1397
|
+
expPre: { margin: 0, whiteSpace: 'pre-wrap', wordBreak: 'break-word', fontSize: 12, lineHeight: 1.6, fontFamily: 'ui-monospace, monospace', background: '#f8f8f8', border: '1px solid #e5e5e5', borderRadius: 10, padding: 12 },
|
|
1389
1398
|
// 大类标题 + 问号(0.3.10):问号贴着标题,气泡以它为锚点弹出来。
|
|
1390
1399
|
// 标题本身 0.6 透明(S.groupTitle),外层不透明——否则气泡里的字也被压淡。
|
|
1391
1400
|
groupHead: { display: 'flex', alignItems: 'center', gap: 6, flexWrap: 'wrap', opacity: 1 },
|
|
@@ -1394,7 +1403,7 @@ window.__ModuleLoader__.load({
|
|
|
1394
1403
|
helpBtn: { width: 16, height: 16, padding: 0, lineHeight: '14px', borderRadius: 999, border: '1px solid #c9c9c9', background: 'transparent', color: 'inherit', fontSize: 11, cursor: 'pointer', opacity: 0.75, flex: '0 0 auto' },
|
|
1395
1404
|
helpBtnOn: { width: 16, height: 16, padding: 0, lineHeight: '14px', borderRadius: 999, border: '1px solid #4078ff', background: 'transparent', color: '#4078ff', fontSize: 11, cursor: 'pointer', fontWeight: 600, flex: '0 0 auto' },
|
|
1396
1405
|
// 气泡压在下面的行上面:绝对定位 + zIndex,不改任何父容器的定位与溢出。
|
|
1397
|
-
helpBubble: { position: 'absolute', top: '135%', left: 0, zIndex: 60, width: 400, maxWidth: '76vw', padding: '10px 12px', borderRadius: 10, border: '1px solid #d6d6d6', background: '#f8f8f8', color: 'inherit', boxShadow: '0 6px 20px rgba(0,0,0,.18)', fontSize: 12, lineHeight: 1.65, whiteSpace: 'pre-wrap', wordBreak: 'break-word', textAlign: 'left', fontWeight: 'normal'
|
|
1406
|
+
helpBubble: { position: 'absolute', top: '135%', left: 0, zIndex: 60, width: 400, maxWidth: '76vw', padding: '10px 12px', borderRadius: 10, border: '1px solid #d6d6d6', background: '#f8f8f8', color: 'inherit', boxShadow: '0 6px 20px rgba(0,0,0,.18)', fontSize: 12, lineHeight: 1.65, whiteSpace: 'pre-wrap', wordBreak: 'break-word', textAlign: 'left', fontWeight: 'normal' },
|
|
1398
1407
|
// 工具组目录那一行:等宽、可选中复制(路径要能被人直接拿去用)。
|
|
1399
1408
|
pathLine: { fontSize: 12, fontFamily: 'ui-monospace, monospace', opacity: 0.72, wordBreak: 'break-all', margin: '2px 0 0', userSelect: 'text' },
|
|
1400
1409
|
swOn: { flex: '0 0 auto', padding: '5px 12px', borderRadius: 999, border: '1px solid #4078ff', background: '#4078ff', color: '#fff', fontSize: 12, fontWeight: 600, cursor: 'pointer' },
|
|
@@ -1615,6 +1624,146 @@ window.__ModuleLoader__.load({
|
|
|
1615
1624
|
}))
|
|
1616
1625
|
}
|
|
1617
1626
|
|
|
1627
|
+
// 0.6.2:自绘滑条。原生 ::-webkit-scrollbar 在触屏上拖不动,所以隐藏原生滑条,
|
|
1628
|
+
// 由这里用 pointer 事件接管:拇指位移 dy → 滚动 dy × (scrollHeight-clientHeight)/(轨道高-拇指高),
|
|
1629
|
+
// 拇指与手指 1:1 跟手;只滚自己这一层,鼠标和触屏都一样。
|
|
1630
|
+
var RAIL_W = 20
|
|
1631
|
+
|
|
1632
|
+
function ScrollBox(props) {
|
|
1633
|
+
var scrollRef = React.useRef(null)
|
|
1634
|
+
var railRef = React.useRef(null)
|
|
1635
|
+
var vs = React.useState({ sh: 0, ch: 0, top: 0, track: 0 })
|
|
1636
|
+
var view = vs[0], setView = vs[1]
|
|
1637
|
+
var drag = React.useRef(null)
|
|
1638
|
+
var hs = React.useState(false)
|
|
1639
|
+
var hot = hs[0], setHot = hs[1]
|
|
1640
|
+
|
|
1641
|
+
function measure() {
|
|
1642
|
+
var el = scrollRef.current
|
|
1643
|
+
if (!el) return
|
|
1644
|
+
// 轨道高要实测:预览框的 pre 有 padding/border,clientHeight 会比轨道短一截。
|
|
1645
|
+
var next = { sh: el.scrollHeight, ch: el.clientHeight, top: el.scrollTop, track: railRef.current ? railRef.current.clientHeight : 0 }
|
|
1646
|
+
setView(function (prev) {
|
|
1647
|
+
if (prev.sh === next.sh && prev.ch === next.ch && prev.top === next.top && prev.track === next.track) return prev
|
|
1648
|
+
return next
|
|
1649
|
+
})
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
function setTop(v) {
|
|
1653
|
+
var el = scrollRef.current
|
|
1654
|
+
if (!el) return
|
|
1655
|
+
var range = el.scrollHeight - el.clientHeight
|
|
1656
|
+
if (range < 0) range = 0
|
|
1657
|
+
if (v < 0) v = 0
|
|
1658
|
+
if (v > range) v = range
|
|
1659
|
+
el.scrollTop = v
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
React.useEffect(function () {
|
|
1663
|
+
var el = scrollRef.current
|
|
1664
|
+
if (!el) return
|
|
1665
|
+
measure()
|
|
1666
|
+
var ro = typeof ResizeObserver === 'function' ? new ResizeObserver(measure) : null
|
|
1667
|
+
if (ro) {
|
|
1668
|
+
ro.observe(el)
|
|
1669
|
+
Array.prototype.forEach.call(el.children, function (c) { ro.observe(c) })
|
|
1670
|
+
}
|
|
1671
|
+
var mo = typeof MutationObserver === 'function' ? new MutationObserver(measure) : null
|
|
1672
|
+
if (mo) mo.observe(el, { childList: true, subtree: true, characterData: true })
|
|
1673
|
+
return function () {
|
|
1674
|
+
if (ro) ro.disconnect()
|
|
1675
|
+
if (mo) mo.disconnect()
|
|
1676
|
+
}
|
|
1677
|
+
}, [])
|
|
1678
|
+
|
|
1679
|
+
// 每次渲染后再量一次:切标签、展开工作区、导入回执都会改内容高度。
|
|
1680
|
+
React.useEffect(function () { measure() })
|
|
1681
|
+
|
|
1682
|
+
var sh = view.sh, ch = view.ch, top = view.top
|
|
1683
|
+
var can = sh - ch > 1
|
|
1684
|
+
var trackH = view.track > 0 ? view.track : ch
|
|
1685
|
+
var thumbH = can ? Math.max(48, Math.round(trackH * ch / sh)) : 0
|
|
1686
|
+
if (thumbH > trackH) thumbH = trackH
|
|
1687
|
+
var maxThumb = trackH - thumbH
|
|
1688
|
+
var thumbTop = can && maxThumb > 0 ? Math.min(maxThumb, Math.round(maxThumb * top / (sh - ch))) : 0
|
|
1689
|
+
|
|
1690
|
+
function thumbDown(e) {
|
|
1691
|
+
if (!can) return
|
|
1692
|
+
e.preventDefault()
|
|
1693
|
+
e.stopPropagation()
|
|
1694
|
+
setHot(true)
|
|
1695
|
+
try { e.currentTarget.setPointerCapture(e.pointerId) } catch (err) { /* 老浏览器:退化为普通拖动 */ }
|
|
1696
|
+
drag.current = { y: e.clientY, top: scrollRef.current ? scrollRef.current.scrollTop : 0 }
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
function thumbMove(e) {
|
|
1700
|
+
var d = drag.current
|
|
1701
|
+
if (!d) return
|
|
1702
|
+
e.preventDefault()
|
|
1703
|
+
e.stopPropagation()
|
|
1704
|
+
var range = sh - ch
|
|
1705
|
+
if (range <= 0) return
|
|
1706
|
+
setTop(d.top + (maxThumb > 0 ? (e.clientY - d.y) * range / maxThumb : 0))
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
function thumbUp(e) {
|
|
1710
|
+
if (!drag.current) return
|
|
1711
|
+
drag.current = null
|
|
1712
|
+
setHot(false)
|
|
1713
|
+
try { e.currentTarget.releasePointerCapture(e.pointerId) } catch (err) { /* 同上 */ }
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
function railDown(e) {
|
|
1717
|
+
if (!can) return
|
|
1718
|
+
e.preventDefault()
|
|
1719
|
+
e.stopPropagation()
|
|
1720
|
+
var box = e.currentTarget.getBoundingClientRect()
|
|
1721
|
+
var pos = maxThumb > 0 ? (e.clientY - box.top - thumbH / 2) / maxThumb : 0
|
|
1722
|
+
if (pos < 0) pos = 0
|
|
1723
|
+
if (pos > 1) pos = 1
|
|
1724
|
+
setTop(pos * (sh - ch))
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
var rail = can ? h('div', {
|
|
1728
|
+
ref: railRef,
|
|
1729
|
+
style: { flex: '0 0 ' + RAIL_W + 'px', width: RAIL_W, position: 'relative', touchAction: 'none', zIndex: 5 },
|
|
1730
|
+
onPointerDown: railDown,
|
|
1731
|
+
role: 'scrollbar',
|
|
1732
|
+
'aria-orientation': 'vertical',
|
|
1733
|
+
'aria-valuenow': Math.round(top),
|
|
1734
|
+
'aria-valuemin': 0,
|
|
1735
|
+
'aria-valuemax': Math.max(0, sh - ch)
|
|
1736
|
+
},
|
|
1737
|
+
h('div', {
|
|
1738
|
+
style: {
|
|
1739
|
+
position: 'absolute', right: 2, top: thumbTop, width: RAIL_W - 4, height: thumbH,
|
|
1740
|
+
borderRadius: 20, background: hot ? 'rgba(0,0,0,.62)' : 'rgba(0,0,0,.38)',
|
|
1741
|
+
touchAction: 'none', userSelect: 'none', WebkitUserSelect: 'none'
|
|
1742
|
+
},
|
|
1743
|
+
onPointerDown: thumbDown,
|
|
1744
|
+
onPointerMove: thumbMove,
|
|
1745
|
+
onPointerUp: thumbUp,
|
|
1746
|
+
onPointerCancel: thumbUp
|
|
1747
|
+
})
|
|
1748
|
+
) : null
|
|
1749
|
+
// 不滚动时轨道也占 20px,内容宽度不会来回跳。
|
|
1750
|
+
var railBox = rail || h('div', { style: { flex: '0 0 ' + RAIL_W + 'px', width: RAIL_W } })
|
|
1751
|
+
|
|
1752
|
+
return h('div', { style: Object.assign({ position: 'relative', display: 'flex', flexDirection: 'column', minHeight: 0 }, props.boxStyle || {}) },
|
|
1753
|
+
h('div', { style: { display: 'flex', flexDirection: 'row', flex: '1 1 auto', minHeight: 0 } },
|
|
1754
|
+
h(props.as || 'div', {
|
|
1755
|
+
ref: scrollRef,
|
|
1756
|
+
className: 'seal-scroll',
|
|
1757
|
+
style: Object.assign({ flex: '1 1 auto', minWidth: 0, minHeight: 0 }, props.style || {}),
|
|
1758
|
+
onScroll: measure
|
|
1759
|
+
}, props.children),
|
|
1760
|
+
railBox
|
|
1761
|
+
),
|
|
1762
|
+
// 0.6.2:页脚状态区固定在这一层(不随正文滚),「已保存」这类回执才落在页底。
|
|
1763
|
+
props.footer || null
|
|
1764
|
+
)
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1618
1767
|
function Section(props) {
|
|
1619
1768
|
var hasHost = props !== null && props !== undefined && typeof props.useSessions === 'function'
|
|
1620
1769
|
return hasHost ? h(SectionHost, props) : h(SectionFallback)
|
|
@@ -1641,6 +1790,9 @@ window.__ModuleLoader__.load({
|
|
|
1641
1790
|
var tab = t[0], setTab = t[1]
|
|
1642
1791
|
var sel = React.useState(null)
|
|
1643
1792
|
var selected = sel[0], setSelected = sel[1]
|
|
1793
|
+
// 0.6.2:会话页的工作区默认收起,点列表头展开;展开状态按 cwd 记。
|
|
1794
|
+
var wso = React.useState({})
|
|
1795
|
+
var wsOpen = wso[0], setWsOpen = wso[1]
|
|
1644
1796
|
var rng = React.useState(null)
|
|
1645
1797
|
var range = rng[0], setRange = rng[1]
|
|
1646
1798
|
// 回执(0.5.1):带上它属于哪个标签。以前是一条全页共享的字符串,而那一行
|
|
@@ -1727,6 +1879,14 @@ window.__ModuleLoader__.load({
|
|
|
1727
1879
|
/** 写一条本页回执:记下当前标签。切页时由下面的 effect 清掉。 */
|
|
1728
1880
|
function showNote(text) { setNote({ tab: tab, text: text }) }
|
|
1729
1881
|
|
|
1882
|
+
/** 0.6.2:会话页工作区折叠 —— 点列表头展开/收起,默认全部收起。 */
|
|
1883
|
+
function toggleWs(cwd) {
|
|
1884
|
+
var next = Object.assign({}, wsOpen)
|
|
1885
|
+
if (next[cwd]) delete next[cwd]
|
|
1886
|
+
else next[cwd] = true
|
|
1887
|
+
setWsOpen(next)
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1730
1890
|
// 换会话就把上一轮的选择清掉,否则会拿着旧工作区的选中项继续显示。
|
|
1731
1891
|
React.useEffect(function () {
|
|
1732
1892
|
setSelected(null); setMemPick(null); setRange(null); setConfirming(''); setNote(null)
|
|
@@ -2235,7 +2395,7 @@ window.__ModuleLoader__.load({
|
|
|
2235
2395
|
h('div', { style: S.optGroup },
|
|
2236
2396
|
tr('tl.preview') + (toolSequence !== null && toolSequence.bytes ? tr('tl.bytes', toolSequence.bytes) : '') +
|
|
2237
2397
|
(on ? '' : ' ' + tr('tl.off'))),
|
|
2238
|
-
h(
|
|
2398
|
+
h(ScrollBox, { as: 'pre', style: S.expPre, boxStyle: { maxHeight: '38vh', marginRight: 24 } }, preview),
|
|
2239
2399
|
h('div', { style: S.note }, tr('tl.note')),
|
|
2240
2400
|
h('div', { style: S.note, 'data-tl-refresh': refreshMode },
|
|
2241
2401
|
refreshMode === 'realtime' ? tr('tl.note.realtime') : tr('tl.note.newSession')),
|
|
@@ -2417,14 +2577,31 @@ window.__ModuleLoader__.load({
|
|
|
2417
2577
|
for (var nz = 0; nz < data.workspaces.length; nz++) {
|
|
2418
2578
|
if (data.workspaces[nz].sessions.some(function (x) { return x.digestCode === 'no-zstd' })) { noZstd = true; break }
|
|
2419
2579
|
}
|
|
2420
|
-
|
|
2580
|
+
// 0.6.2:所有工作区的会话排进同一个列表,滚动交给外层整页(S.page)。
|
|
2581
|
+
// 每个工作区默认收起,点列表头展开;选中的工作区在收起状态下也留着蓝点。
|
|
2582
|
+
body = h('div', { style: S.list },
|
|
2421
2583
|
noZstd ? h('div', { style: S.note }, tr('digest.noZstd')) : null,
|
|
2422
2584
|
data.workspaces.map(function (ws) {
|
|
2423
2585
|
if (ws.sessions.length === 0) return null
|
|
2424
2586
|
var ac = ws.sessions.filter(function (x) { return x.archived }).length
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2587
|
+
var opens = wsOpen[ws.cwd] === true
|
|
2588
|
+
var hasSel = selected !== null && selected.cwd === ws.cwd
|
|
2589
|
+
return h('div', { key: ws.cwd, style: { display: 'flex', flexDirection: 'column', gap: 6 } },
|
|
2590
|
+
h('div', { style: S.disc },
|
|
2591
|
+
h('button', {
|
|
2592
|
+
style: S.discBtn,
|
|
2593
|
+
'data-ws-head': ws.cwd,
|
|
2594
|
+
'aria-expanded': opens ? 'true' : 'false',
|
|
2595
|
+
onClick: function () { toggleWs(ws.cwd) }
|
|
2596
|
+
},
|
|
2597
|
+
h('span', { style: S.caret }, opens ? '▾' : '▸'),
|
|
2598
|
+
h('span', { style: Object.assign({}, S.title, { textAlign: 'left' }) }, ws.cwd),
|
|
2599
|
+
hasSel ? h('span', { style: S.dotOn }) : null,
|
|
2600
|
+
ac > 0 ? h('span', { style: S.badge }, tr('ws.archived', ac)) : null,
|
|
2601
|
+
h('span', { style: { opacity: 0.55, flex: '0 0 auto', fontSize: 11 } }, String(ws.sessions.length))
|
|
2602
|
+
)
|
|
2603
|
+
),
|
|
2604
|
+
opens ? ws.sessions.map(function (sess) {
|
|
2428
2605
|
var on = selected && selected.id === sess.id
|
|
2429
2606
|
return h(Row, {
|
|
2430
2607
|
key: sess.id, title: sess.id, on: on, archived: sess.archived,
|
|
@@ -2434,7 +2611,7 @@ window.__ModuleLoader__.load({
|
|
|
2434
2611
|
h('span', { style: Object.assign({}, S.title, sess.hasTitle ? {} : S.muted) }, sess.title),
|
|
2435
2612
|
sess.archived ? h('span', { style: S.badge }, tr('badge.archived')) : null
|
|
2436
2613
|
)
|
|
2437
|
-
})
|
|
2614
|
+
}) : null
|
|
2438
2615
|
)
|
|
2439
2616
|
}))
|
|
2440
2617
|
} else {
|
|
@@ -2516,7 +2693,7 @@ window.__ModuleLoader__.load({
|
|
|
2516
2693
|
ranged && shown.length === 0
|
|
2517
2694
|
? h('div', { style: S.note }, tr('range.empty', range.from, range.to))
|
|
2518
2695
|
: null,
|
|
2519
|
-
h(
|
|
2696
|
+
h(ScrollBox, { style: S.preWide, boxStyle: { maxHeight: '52vh', marginRight: 24 } }, memPick && !picked ? tr('loading') : boxText),
|
|
2520
2697
|
h('div', { style: { display: 'flex', justifyContent: 'flex-end' } },
|
|
2521
2698
|
h('button', {
|
|
2522
2699
|
style: !memPick || isBusy ? S.btnOff : S.btnDanger,
|
|
@@ -2540,8 +2717,9 @@ window.__ModuleLoader__.load({
|
|
|
2540
2717
|
|
|
2541
2718
|
// 「导入」在最左(0.6.1):删除 / 删除并回顾 这一行从左边加一颗按钮。
|
|
2542
2719
|
// 宿主 Node 写不了 zstd 时这颗按钮明确变灰,并在会话页里说明原因。
|
|
2720
|
+
// 0.6.2:这一行从页底挪到页头 —— 不用滚到列表底部才够得着三颗按钮。
|
|
2543
2721
|
var canImport = !(data.capabilities && data.capabilities.table && data.capabilities.table['zstd.compress'] === false)
|
|
2544
|
-
var
|
|
2722
|
+
var sessionBar = tab === 'sessions' ? h('div', { style: S.sessionBar },
|
|
2545
2723
|
h('button', {
|
|
2546
2724
|
style: (isBusy || sessionBusy || !canImport) ? S.btnOff : S.btn,
|
|
2547
2725
|
disabled: isBusy || sessionBusy || !canImport,
|
|
@@ -2554,18 +2732,17 @@ window.__ModuleLoader__.load({
|
|
|
2554
2732
|
isCompacting ? tr('btn.compacting') : (confirming === 'compact' ? tr('btn.confirmCompact') : tr('btn.deleteCompact')))
|
|
2555
2733
|
) : null
|
|
2556
2734
|
|
|
2557
|
-
//
|
|
2558
|
-
//
|
|
2559
|
-
//
|
|
2735
|
+
// 0.6.2:页面级滚动框全部删掉 —— 会话/自创工具/回顾/选项四页都在同一个
|
|
2736
|
+
// 整页滚动框(最外层 wrap 的 .recall-scroll)里滚,全插件只剩这一条页面滑条;
|
|
2737
|
+
// 预览框内部的滑条不动(自创工具、回顾各一条)。
|
|
2738
|
+
// 会话页自己的回执、弹窗与能力说明仍挂在页面里面:切到别页就一起消失。
|
|
2560
2739
|
var pageInner = tab === 'sessions'
|
|
2561
2740
|
? h('div', null, body,
|
|
2562
2741
|
canImport ? null : h('div', { style: S.note, 'data-session-import-off': '1' }, tr('si.noZstd')),
|
|
2563
2742
|
sessionNote ? h('div', { style: S.note, 'data-session-import-note': '1' }, sessionNote) : null,
|
|
2564
2743
|
sessionImportDialogView())
|
|
2565
2744
|
: body
|
|
2566
|
-
var pageBox =
|
|
2567
|
-
? h('div', { style: S.pageFlat }, pageInner)
|
|
2568
|
-
: h('div', { className: 'recall-scroll', style: S.page }, pageInner)
|
|
2745
|
+
var pageBox = h('div', { style: S.page }, pageInner)
|
|
2569
2746
|
|
|
2570
2747
|
// E1:宿主能力不全时,在每页顶部都说清缺了什么、哪块被关了。
|
|
2571
2748
|
var missingCaps = data.capabilities && data.capabilities.ok === false
|
|
@@ -2574,10 +2751,16 @@ window.__ModuleLoader__.load({
|
|
|
2574
2751
|
? h('div', { style: S.err }, tr('host.degraded', missingCaps.map(function (m) { return m.block }).join(', ')))
|
|
2575
2752
|
: null
|
|
2576
2753
|
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2754
|
+
// 0.6.2:回执(「已保存」等)和报错放进页脚状态区,固定在页底,不跟着正文滚。
|
|
2755
|
+
var footNote = note && note.tab === tab ? note.text : ''
|
|
2756
|
+
var footErr = errState && errState.tab === tab ? errState.text : ''
|
|
2757
|
+
var statusFoot = (footNote || footErr) ? h('div', { style: S.status, 'data-status': '1' },
|
|
2758
|
+
footNote ? h('div', { style: S.note }, footNote) : null,
|
|
2759
|
+
footErr ? h('div', { style: S.err }, footErr) : null
|
|
2760
|
+
) : null
|
|
2761
|
+
|
|
2762
|
+
return h(ScrollBox, { style: S.wrap, boxStyle: { maxHeight: '100%' }, footer: statusFoot },
|
|
2763
|
+
head, tabs, capWarn, sessionBar, pageBox,
|
|
2581
2764
|
h('input', {
|
|
2582
2765
|
type: 'file',
|
|
2583
2766
|
accept: '.zip,application/zip',
|