dsh-sticky-user-bubble 0.4.0 → 0.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/CHANGELOG.md +25 -0
- package/README.md +4 -2
- package/client.js +112 -1
- package/lib/index.js +4 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
本文件记录本项目的所有重要变更。
|
|
4
4
|
|
|
5
|
+
## [0.6.0] - 2026-11-26
|
|
6
|
+
|
|
7
|
+
### 新增
|
|
8
|
+
|
|
9
|
+
- **与 DSH 0.2.3 的「会话面板」共存**:面板在窄窗口下以 `overlay` 形态浮在正文右上(会话内容层),本插件的副本在 `shell.overlay`(frame 层),原本会盖住面板。现在副本检测 `[data-session-panel]`:与面板自然矩形相交时先左移到面板左侧(保留 8px 间隙,且不越出 `[data-chat-flow]` 左边界),正文列放不下时隐藏副本;面板关闭或移开后自动恢复。停靠在正文右侧的 `docked` 形态不触发让位。
|
|
10
|
+
- host 新增诊断属性 `data-dsh-sticky-user-bubble-occlusion`(`shifted` / `hidden`,无遮挡时移除);`data-dsh-sticky-user-bubble-state` 的 `ready` 语义不变。
|
|
11
|
+
- 面板进入/退场动画期间按帧跟踪面板矩形,让位位置跟到最终值,不在动画中途停住。
|
|
12
|
+
|
|
13
|
+
### 变更
|
|
14
|
+
|
|
15
|
+
- 副本的 `visibility` 由最后的遮挡判定决定(渲染时先设为可见,再按面板结果覆盖),其余出现阈值、让位清距、展开上限与跳回行为不变。
|
|
16
|
+
|
|
17
|
+
### 文档与测试
|
|
18
|
+
|
|
19
|
+
- 单测新增「重叠时左移」与「空间不足隐藏」两条用例(含面板关闭后的恢复),共 30 项。
|
|
20
|
+
- `AGENTS.md` 记录 `[data-session-panel]` 契约与 0.2.3-alpha.2 实测数据(1512 dock 不误伤 / 1180 overlay 左移 / 900 隐藏 / 四档滚动位置稳定)。
|
|
21
|
+
|
|
22
|
+
## [0.5.0] - 2026-11-26
|
|
23
|
+
|
|
24
|
+
### 变更
|
|
25
|
+
|
|
26
|
+
- **跨到 `0.2.3` 发布线**:兼容线从 `>=0.2.2-alpha.2 <0.2.3` 整体换成 `>=0.2.3-alpha.2 <0.2.4`,逐版本核对 `0.2.3-alpha.2`;`0.2.2` 及更早版本留在 `0.4.x`,范围外继续 inert。
|
|
27
|
+
- 静态契约复核:`[data-conversation-scroll]`、`[data-chat-flow]`、行标记、`[data-composer-seat]`、`shell.overlay`、`uiConversation`、`retainedBy` 与 `data-ref-chip` 均仍在;业务代码未改。
|
|
28
|
+
- **未重跑六项几何量测**(需要长会话真机);下一次 GUI 验收需覆盖出现阈值、让位清距、裁剪、三行折叠、展开上限与跳回。
|
|
29
|
+
|
|
5
30
|
## [0.4.0] - 2026-11-05
|
|
6
31
|
|
|
7
32
|
### 变更
|
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
- 固定当前已**完整**滚出对话可视区顶部的用户或 durable steering 气泡;向上、向下滚动时按真实消息顺序切换。
|
|
8
8
|
- 原气泡仍有任何可见部分(包括底部内边距与圆角)时保持隐藏,不会出现原气泡与副本同时可见。
|
|
9
9
|
- 下一条用户卡片进入顶部区域时,固定气泡像列表 sticky 标题一样被它顶出去(超出对话顶边的部分被裁掉),不会盖住新卡片,并保持与对话一致的消息间距;新卡片到达阅读线时固定气泡完全消失。
|
|
10
|
+
- 与 DSH 的**会话面板**共存:面板以悬浮形态出现在正文右上时,固定气泡让到面板左侧(保留间距);正文列放不下时暂时收起,面板关闭或移开后自动恢复。停靠在正文右侧的面板不触发让位。
|
|
10
11
|
- 点击固定气泡平滑滚动回对应的原始用户输入位置;键盘聚焦后按 `Enter` 或空格键同样有效。
|
|
11
12
|
- 超过三行时默认只显示三行并以省略号截断,鼠标移入或键盘聚焦时恢复完整内容;展开高度同时受**输入框顶部**和「下一条用户卡片上方空间」限制,超出部分在气泡内部滚动,空间只剩消息间距时保持三行不展开。
|
|
12
13
|
- 内部滚动发生在气泡 padding 之内:滚动条不会压住圆角边框,并沿用 DSH「卡片内滚动区域」的暗色滑块。
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
|
|
18
19
|
## 要求
|
|
19
20
|
|
|
20
|
-
- DeepSeek Harness Web `>=0.2.
|
|
21
|
+
- DeepSeek Harness Web `>=0.2.3-alpha.2 <0.2.4`;`0.2.3-alpha.2` 已做静态契约核对(DOM 标记、`shell.overlay`、`uiConversation`、`retainedBy` 与 `data-ref-chip` 均在),**未重跑六项几何量测**(需要长会话真机)。同线其他版本会给出警告,并继续依赖客户端结构与能力检查;范围外保持 inert——**0.2.2 及更早的 DSH 请继续用上一发布线版本的本插件**。
|
|
21
22
|
- Node.js 20 或更高版本(仅安装与发布检查需要)。
|
|
22
23
|
- 不需要额外的运行时 npm 依赖。
|
|
23
24
|
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
|
|
26
27
|
```bash
|
|
27
28
|
dsh plugin --profile web add dsh-sticky-user-bubble # 安装
|
|
28
|
-
dsh plugin --profile web add dsh-sticky-user-bubble@0.
|
|
29
|
+
dsh plugin --profile web add dsh-sticky-user-bubble@0.6.0 # 升级到指定版本
|
|
29
30
|
dsh plugin --profile web remove dsh-sticky-user-bubble # 卸载
|
|
30
31
|
```
|
|
31
32
|
|
|
@@ -41,6 +42,7 @@ dsh plugin --profile web remove dsh-sticky-user-bubble # 卸载
|
|
|
41
42
|
- 纯图片消息没有文本气泡时不会伪造文字副本。
|
|
42
43
|
- 尚未成为 durable 节点的 pending steering 行不参与切换;尚未点「加载更早」的历史消息也不在当前窗口内,插件有意不自动调用 `loadOlder()`。
|
|
43
44
|
- 展开窗口只剩消息间距级空间时 hover 不再展开(避免退化成极窄的内部滚动窗口);要读全文,向上滚一点让下一张卡片离开即可恢复。
|
|
45
|
+
- 会话面板让位依赖 DSH 的 `[data-session-panel]` 标记:标记消失时退回旧行为(固定气泡不再让位),固定气泡本身不受影响。
|
|
44
46
|
- 这是纯客户端行为:不提供开关、不保存历史数据、也不新增 Host 路由。
|
|
45
47
|
|
|
46
48
|
## License
|
package/client.js
CHANGED
|
@@ -17,6 +17,12 @@ window.__ModuleLoader__.load({
|
|
|
17
17
|
// The composer is sticky at the bottom inside the conversation scrollport, so the
|
|
18
18
|
// scrollport's own bottom edge is not the end of the reading area.
|
|
19
19
|
const COMPOSER_SELECTOR = '[data-composer-seat]'
|
|
20
|
+
// DSH 0.2.3-alpha.2 adds the conversation session panel in the header's utilities
|
|
21
|
+
// seat. In its `overlay` form it floats above the chat column, inside the same
|
|
22
|
+
// stacking context as the conversation view, so the shell-overlay clone paints on
|
|
23
|
+
// top of it. The panel is an explicit, temporary surface: the clone yields.
|
|
24
|
+
const SESSION_PANEL_SELECTOR = '[data-session-panel]'
|
|
25
|
+
const PANEL_CLEARANCE = 8
|
|
20
26
|
const USER_KINDS = new Set(['user', 'steering'])
|
|
21
27
|
const BUBBLE_MARKERS = ['[data-user-bubble]', '[data-chat-user-bubble]']
|
|
22
28
|
// DSH's user-text projector emits `data-ref-chip="<kind>"` plus `title="<raw token>"`
|
|
@@ -927,6 +933,77 @@ window.__ModuleLoader__.load({
|
|
|
927
933
|
target?.scrollIntoView?.({ behavior: 'smooth', block: 'start' })
|
|
928
934
|
}
|
|
929
935
|
|
|
936
|
+
function sessionPanelOf() {
|
|
937
|
+
const ownerDocument = typeof document === 'undefined' ? undefined : document
|
|
938
|
+
if (ownerDocument === null || ownerDocument === undefined) return null
|
|
939
|
+
if (typeof ownerDocument.querySelector !== 'function') return null
|
|
940
|
+
const panel = ownerDocument.querySelector(SESSION_PANEL_SELECTOR)
|
|
941
|
+
if (panel === null || panel === undefined) return null
|
|
942
|
+
return typeof panel.getBoundingClientRect === 'function' ? panel : null
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
// Overlap uses the clone's natural box (`pin.left`, the real top after the yield
|
|
946
|
+
// push) instead of its current box: after the clone has been shifted aside, testing
|
|
947
|
+
// the shifted box would flip the decision back and forth on every frame.
|
|
948
|
+
function panelOverlap(left, top, width, height, panelRect) {
|
|
949
|
+
return left < panelRect.right - EPSILON
|
|
950
|
+
&& left + width > panelRect.left + EPSILON
|
|
951
|
+
&& top < panelRect.bottom - EPSILON
|
|
952
|
+
&& top + height > panelRect.top + EPSILON
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
// Left edge of the chat column: a shifted clone may not drift over the rail or the
|
|
956
|
+
// conversation's side gutters. Falls back to the host box when the flow is absent.
|
|
957
|
+
function chatColumnLeft(fallbackLeft) {
|
|
958
|
+
const ownerDocument = typeof document === 'undefined' ? undefined : document
|
|
959
|
+
if (ownerDocument !== null && ownerDocument !== undefined && typeof ownerDocument.querySelector === 'function') {
|
|
960
|
+
const flow = ownerDocument.querySelector(FLOW_SELECTOR)
|
|
961
|
+
const flowRect = flow === null || flow === undefined ? null : rectOf(flow)
|
|
962
|
+
if (flowRect !== null) return flowRect.left
|
|
963
|
+
}
|
|
964
|
+
return fallbackLeft
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
// A session panel that overlaps the clone takes precedence: the clone slides to the
|
|
968
|
+
// panel's left while the chat column still has room, otherwise it steps out entirely.
|
|
969
|
+
// The original bubble is untouched; this only moves or hides the reading copy.
|
|
970
|
+
function applyPanelYield(host, clone, pin) {
|
|
971
|
+
const restore = () => {
|
|
972
|
+
setStyleValue(clone, 'left', `${pin.left}px`, true)
|
|
973
|
+
setStyleValue(clone, 'visibility', 'visible', true)
|
|
974
|
+
host?.removeAttribute?.('data-dsh-sticky-user-bubble-occlusion')
|
|
975
|
+
}
|
|
976
|
+
const panel = sessionPanelOf()
|
|
977
|
+
if (panel === null
|
|
978
|
+
|| typeof host?.getBoundingClientRect !== 'function'
|
|
979
|
+
|| typeof clone.getBoundingClientRect !== 'function') {
|
|
980
|
+
restore()
|
|
981
|
+
return
|
|
982
|
+
}
|
|
983
|
+
const hostRect = host.getBoundingClientRect()
|
|
984
|
+
const cloneRect = clone.getBoundingClientRect()
|
|
985
|
+
const panelRect = panel.getBoundingClientRect()
|
|
986
|
+
if (!finiteDimension(cloneRect.width) || !finiteDimension(cloneRect.height)) {
|
|
987
|
+
restore()
|
|
988
|
+
return
|
|
989
|
+
}
|
|
990
|
+
const naturalLeft = hostRect.left + pin.left
|
|
991
|
+
const naturalTop = cloneRect.top
|
|
992
|
+
if (!panelOverlap(naturalLeft, naturalTop, cloneRect.width, cloneRect.height, panelRect)) {
|
|
993
|
+
restore()
|
|
994
|
+
return
|
|
995
|
+
}
|
|
996
|
+
const shiftedLeft = panelRect.left - cloneRect.width - PANEL_CLEARANCE
|
|
997
|
+
if (shiftedLeft >= chatColumnLeft(hostRect.left) - EPSILON) {
|
|
998
|
+
setStyleValue(clone, 'left', `${shiftedLeft - hostRect.left}px`, true)
|
|
999
|
+
setStyleValue(clone, 'visibility', 'visible', true)
|
|
1000
|
+
host?.setAttribute?.('data-dsh-sticky-user-bubble-occlusion', 'shifted')
|
|
1001
|
+
return
|
|
1002
|
+
}
|
|
1003
|
+
setStyleValue(clone, 'visibility', 'hidden', true)
|
|
1004
|
+
host?.setAttribute?.('data-dsh-sticky-user-bubble-occlusion', 'hidden')
|
|
1005
|
+
}
|
|
1006
|
+
|
|
930
1007
|
// The clone is only moved while it yields to the next user card, never rebuilt:
|
|
931
1008
|
// re-measuring the whole bubble on every scroll frame would jitter. Only the clone's
|
|
932
1009
|
// layout origin and the clip at the scrollport edge change, so both stay cheap
|
|
@@ -939,6 +1016,7 @@ window.__ModuleLoader__.load({
|
|
|
939
1016
|
const clipped = Math.max(0, push - inset)
|
|
940
1017
|
setStyleValue(clone, 'top', `${pin.top - push}px`, true)
|
|
941
1018
|
setStyleValue(clone, 'clipPath', clipped > EPSILON ? `inset(${clipped}px 0 0 0)` : 'none', true)
|
|
1019
|
+
applyPanelYield(host, clone, pin)
|
|
942
1020
|
}
|
|
943
1021
|
|
|
944
1022
|
function renderPinnedClone(host, pin, stateRef) {
|
|
@@ -1091,13 +1169,14 @@ window.__ModuleLoader__.load({
|
|
|
1091
1169
|
}
|
|
1092
1170
|
rememberIntent()
|
|
1093
1171
|
updateExpanded()
|
|
1094
|
-
applyCloneOffset(host, pin)
|
|
1095
1172
|
setCriticalStyles(clone, {
|
|
1096
1173
|
cursor: 'pointer',
|
|
1097
1174
|
pointerEvents: 'auto',
|
|
1098
1175
|
touchAction: 'manipulation',
|
|
1099
1176
|
visibility: 'visible'
|
|
1100
1177
|
})
|
|
1178
|
+
// Last, so an overlapping session panel can override the visible state above.
|
|
1179
|
+
applyCloneOffset(host, pin)
|
|
1101
1180
|
// Keep an already expanded bubble inside the free room as the next card approaches:
|
|
1102
1181
|
// the measurement loop hands each newer pin to the rendered clone instead of
|
|
1103
1182
|
// rebuilding it, so hovering survives the yield and can never cover that card.
|
|
@@ -1166,8 +1245,39 @@ window.__ModuleLoader__.load({
|
|
|
1166
1245
|
}
|
|
1167
1246
|
}
|
|
1168
1247
|
|
|
1248
|
+
// The session panel animates in, resizes when a section expands, and disappears
|
|
1249
|
+
// without a scroll event. A changed panel box re-runs the yield decision on the
|
|
1250
|
+
// next frame; unchanged boxes stop the loop.
|
|
1251
|
+
let lastPanelRect = null
|
|
1252
|
+
const trackPanelMotion = () => {
|
|
1253
|
+
const panel = sessionPanelOf()
|
|
1254
|
+
if (panel === null) {
|
|
1255
|
+
lastPanelRect = null
|
|
1256
|
+
return
|
|
1257
|
+
}
|
|
1258
|
+
const rect = panel.getBoundingClientRect()
|
|
1259
|
+
if (rect === null || rect === undefined) return
|
|
1260
|
+
const previous = lastPanelRect
|
|
1261
|
+
lastPanelRect = { left: rect.left, top: rect.top, right: rect.right, bottom: rect.bottom }
|
|
1262
|
+
const running = typeof panel.getAnimations === 'function'
|
|
1263
|
+
&& panel.getAnimations().some((animation) => animation.playState === 'running')
|
|
1264
|
+
if (running) {
|
|
1265
|
+
// The enter/exit slide moves the box for a few frames; keep measuring so the
|
|
1266
|
+
// yield follows the final position instead of stopping at an intermediate one.
|
|
1267
|
+
schedule(false)
|
|
1268
|
+
return
|
|
1269
|
+
}
|
|
1270
|
+
if (previous !== null
|
|
1271
|
+
&& Math.abs(rect.left - previous.left) <= 0.5
|
|
1272
|
+
&& Math.abs(rect.top - previous.top) <= 0.5
|
|
1273
|
+
&& Math.abs(rect.right - previous.right) <= 0.5
|
|
1274
|
+
&& Math.abs(rect.bottom - previous.bottom) <= 0.5) return
|
|
1275
|
+
schedule(false)
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1169
1278
|
const measure = (forced) => {
|
|
1170
1279
|
if (disposed) return
|
|
1280
|
+
trackPanelMotion()
|
|
1171
1281
|
const next = measurePinned(scroll, overlayRef.current, modelRef.current)
|
|
1172
1282
|
observeSource(next?.source || null, next?.scroll || null)
|
|
1173
1283
|
if (!forced && samePin(currentPin, next)) {
|
|
@@ -1292,6 +1402,7 @@ window.__ModuleLoader__.load({
|
|
|
1292
1402
|
visualViewport?.removeEventListener?.('resize', onResize)
|
|
1293
1403
|
clearHost(copyHostRef.current)
|
|
1294
1404
|
setHostState(copyHostRef.current, null)
|
|
1405
|
+
lastPanelRect = null
|
|
1295
1406
|
currentPin = null
|
|
1296
1407
|
observedSource = null
|
|
1297
1408
|
observedSourceRoot = null
|
package/lib/index.js
CHANGED
|
@@ -7,18 +7,18 @@ export const inject = []
|
|
|
7
7
|
* 兼容发布线。与 `package.json#dshCompatibility.range` / `engines.dsh` /
|
|
8
8
|
* `install.sh` 的 `DSH_COMPATIBILITY_RANGE` **同源**。
|
|
9
9
|
*/
|
|
10
|
-
export const DSH_COMPATIBILITY_RANGE = '>=0.2.
|
|
10
|
+
export const DSH_COMPATIBILITY_RANGE = '>=0.2.3-alpha.2 <0.2.4'
|
|
11
11
|
/** 发布线本体;兼容线只覆盖这一个 patch 系列。 */
|
|
12
|
-
export const DSH_RELEASE_LINE = '0.2.
|
|
12
|
+
export const DSH_RELEASE_LINE = '0.2.3'
|
|
13
13
|
/**
|
|
14
|
-
* 兼容线下界(`0.2.
|
|
14
|
+
* 兼容线下界(`0.2.3-alpha.2`):同线内更小序列号的 prerelease 都低于下界,
|
|
15
15
|
* 判为不支持。跨线时只改这三个常量,判定逻辑不用动。
|
|
16
16
|
*/
|
|
17
17
|
export const DSH_RELEASE_FLOOR = { channel: 'alpha', sequence: 2 }
|
|
18
18
|
/** prerelease channel 的先后顺序;下标即优先级。 */
|
|
19
19
|
const PRERELEASE_CHANNELS = ['alpha', 'beta', 'rc']
|
|
20
20
|
/** 逐版本核对清单;与 `package.json#dshCompatibility.verifiedVersions` / `install.sh` 同源。 */
|
|
21
|
-
export const VERIFIED_DSH_VERSIONS = ['0.2.
|
|
21
|
+
export const VERIFIED_DSH_VERSIONS = ['0.2.3-alpha.2']
|
|
22
22
|
|
|
23
23
|
export function classifyDshVersion(version) {
|
|
24
24
|
if (typeof version !== 'string') return { supported: false, verified: false }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-sticky-user-bubble",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/zhaoliang233/dsh-plugins.git",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"dshCompatibility": {
|
|
21
21
|
"policy": "compatible-release-line",
|
|
22
22
|
"package": "@deepseek-ai/dsh",
|
|
23
|
-
"range": ">=0.2.
|
|
24
|
-
"verifiedVersions": ["0.2.
|
|
23
|
+
"range": ">=0.2.3-alpha.2 <0.2.4",
|
|
24
|
+
"verifiedVersions": ["0.2.3-alpha.2"],
|
|
25
25
|
"futureVersionsRequireCapabilityChecks": true
|
|
26
26
|
},
|
|
27
27
|
"dsh": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=20",
|
|
56
|
-
"dsh": ">=0.2.
|
|
56
|
+
"dsh": ">=0.2.3-alpha.2 <0.2.4"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|