From befab8bc32451683848dc5fcfdd15a65cca5cef8 Mon Sep 17 00:00:00 2001 From: Yoko Date: Fri, 4 Dec 2026 20:19:36 +0800 Subject: [PATCH 1/2] fix(ai-chat-turbo-engine): keep the peek across the gap to a row submenu A row menu and the flyout it opens often sit more than 32px apart, and the gap hits page blank space, so the adoption threshold missed the hand-off and the hide delay armed mid-gesture. Widen adoption for the target a departure names, treat the 96px corridor around an adopted layer as still the peek, and stop recording parked-transparent or off-screen menus as page-owned popovers. --- .../src/core/sidebar-peek.ts | 169 +++++++++++++++--- tests/ai-chat-turbo-sidebar-peek.test.ts | 159 ++++++++++++++++ 2 files changed, 299 insertions(+), 29 deletions(-) diff --git a/scripts/ai-chat-turbo-engine/src/core/sidebar-peek.ts b/scripts/ai-chat-turbo-engine/src/core/sidebar-peek.ts index ccfd0df..444b75c 100644 --- a/scripts/ai-chat-turbo-engine/src/core/sidebar-peek.ts +++ b/scripts/ai-chat-turbo-engine/src/core/sidebar-peek.ts @@ -129,6 +129,37 @@ const POPOVER_RECHECK_MS = 400; */ export const SIDEBAR_PEEK_ADOPT_MARGIN_PX = 32; +/** + * How far the box the pointer is explicitly heading into may sit from the peek + * and still be adopted. A `pointerout` names that destination, so a hand-off + * into a submenu is intentional even across the larger gap sites leave between + * a row menu and its flyout. Random page flyouts never reach this path: they + * are not the related target of a departure from the panel. + */ +export const SIDEBAR_PEEK_APPROACH_MARGIN_PX = 96; + +/** How a candidate box is tied to the peek when it is adopted. */ +interface AdoptPeekLayerOptions { + /** Distance from the box the peek paints, in pixels. */ + readonly margin?: number; + /** + * Whether the pointer itself vouches for the box: it rests inside it, or a + * departure from the peek was heading into it. A site that parks a menu at + * its final position before opening it is refused by the page-owned snapshot + * otherwise, and the peek would collapse on the way to that menu. + */ + readonly vouched?: boolean; +} + +/** The box under the pointer, or the one the pointer just walked into. */ +const VOUCHED_ADOPTION: AdoptPeekLayerOptions = { vouched: true }; + +/** The box a departure from the peek is heading into, across the site's gap. */ +const DEPARTURE_ADOPTION: AdoptPeekLayerOptions = { + margin: SIDEBAR_PEEK_APPROACH_MARGIN_PX, + vouched: true, +}; + /** * A floating box at least this wide, measured against the viewport, is page * chrome rather than a flyout: an app shell, a scrim, a chat header. Left in, @@ -1796,7 +1827,11 @@ export function createSidebarPeek(options: SidebarPeekOptions): SidebarPeek { if (typeof doc.elementFromPoint !== "function") return null; const hit = doc.elementFromPoint(pointerX, pointerY); if (!(hit instanceof Element)) return null; - return peekLayerAt(hit) ?? adoptPeekLayer(hit) ?? popoverFor(hit); + return ( + peekLayerAt(hit) ?? + adoptPeekLayer(hit, VOUCHED_ADOPTION) ?? + popoverFor(hit) + ); } /** @@ -1812,8 +1847,26 @@ export function createSidebarPeek(options: SidebarPeekOptions): SidebarPeek { if (style.display === "none" || style.visibility === "hidden") { return false; } + // Sites park their row menus off to the side (opacity zero, or laid out + // past the viewport) long before they are opened. Such a box is not a menu + // the user can see, so it must not be recorded as page-owned at peek start + // and then refuse the real menu the same node becomes. + if (style.opacity === "0") return false; const rect = node.getBoundingClientRect(); - return rect.width > 1 && rect.height > 1; + if (rect.width <= 1 || rect.height <= 1) return false; + const width = view.innerWidth || 0; + const height = view.innerHeight || 0; + if (width > 0 && height > 0) { + if ( + rect.right <= 0 || + rect.left >= width || + rect.bottom <= 0 || + rect.top >= height + ) { + return false; + } + } + return true; } /** The visible portaled menu under a press, when it is not the rail itself. */ @@ -1937,16 +1990,48 @@ export function createSidebarPeek(options: SidebarPeekOptions): SidebarPeek { } /** Whether a flyout's box sits against the region the peek paints. */ - function rectTouchesRegion(rect: ScreenBox, region: ScreenBox[]): boolean { + function rectTouchesRegion( + rect: ScreenBox, + region: ScreenBox[], + margin: number = SIDEBAR_PEEK_ADOPT_MARGIN_PX, + ): boolean { return region.some( (box) => - rect.left <= box.right + SIDEBAR_PEEK_ADOPT_MARGIN_PX && - rect.right >= box.left - SIDEBAR_PEEK_ADOPT_MARGIN_PX && - rect.top <= box.bottom + SIDEBAR_PEEK_ADOPT_MARGIN_PX && - rect.bottom >= box.top - SIDEBAR_PEEK_ADOPT_MARGIN_PX, + rect.left <= box.right + margin && + rect.right >= box.left - margin && + rect.top <= box.bottom + margin && + rect.bottom >= box.top - margin, ); } + /** + * Whether the pointer sits within reach of a layer the peek already adopted. + * This is the corridor the pointer crosses on its way from a row menu into + * the submenu that menu opened: the gap fires moves the page, not the menu, + * so proximity to the adopted box keeps the peek from collapsing mid-gesture + * no matter how wide the gap or how slowly the pointer crosses it. + */ + function withinPeekLayers(x: number, y: number, margin: number): boolean { + if (!Number.isFinite(x) || !Number.isFinite(y)) return false; + for (const layer of peekLayers) { + if (!layer.isConnected) { + peekLayers.delete(layer); + continue; + } + const box = layer.getBoundingClientRect(); + if (box.width <= 0 || box.height <= 0) continue; + if ( + x >= box.left - margin && + x <= box.right + margin && + y >= box.top - margin && + y <= box.bottom + margin + ) { + return true; + } + } + return false; + } + /** * A menu the site mounts while the pointer rests on a row appears under that * pointer and fires no move of its own, so the box the cursor is inside @@ -1979,7 +2064,12 @@ export function createSidebarPeek(options: SidebarPeekOptions): SidebarPeek { * under a resting cursor produces no pointer event of its own, and a budget * measured from the pointer's last move dropped exactly that menu. */ - function adoptPeekLayer(target: Element): HTMLElement | null { + function adoptPeekLayer( + target: Element, + options: AdoptPeekLayerOptions = {}, + ): HTMLElement | null { + const margin = options.margin ?? SIDEBAR_PEEK_ADOPT_MARGIN_PX; + const vouched = options.vouched === true; const known = peekLayerAt(target); if (known !== null) return known; const doc = boundDocument; @@ -2018,28 +2108,30 @@ export function createSidebarPeek(options: SidebarPeekOptions): SidebarPeek { const region = panelRegionRects(rail); for (let index = candidates.length - 1; index >= 0; index -= 1) { const layer = candidates[index] as HTMLElement; + // A box the pointer is inside, or the box a departure from the peek was + // heading into, is vouched for by the pointer itself. Sites park such a + // menu at its final position long before it opens -- measured, sized, + // but transparent -- so the snapshot of "the page's own popovers" taken + // when the peek opened would otherwise refuse the very menu the user is + // walking into, and the panel would collapse on the way to it. + const rect = layer.getBoundingClientRect(); + const holds = boxHoldsCursor({ + left: rect.left, + right: rect.right, + top: rect.top, + bottom: rect.bottom, + }); // A menu the page already had on screen is the page's own, and a wrapper // it closed is not the one the pointer is using. - if (isPreexistingPopover(layer)) continue; + if (!vouched && !holds && isPreexistingPopover(layer)) continue; if (!isVisiblePopover(layer, view)) continue; - const rect = layer.getBoundingClientRect(); if ( view.innerWidth > 0 && rect.width >= view.innerWidth * SIDEBAR_PEEK_ADOPT_MAX_WIDTH_RATIO ) { continue; } - if ( - !rectTouchesRegion(rect, region) && - !boxHoldsCursor({ - left: rect.left, - right: rect.right, - top: rect.top, - bottom: rect.bottom, - }) - ) { - continue; - } + if (!holds && !rectTouchesRegion(rect, region, margin)) continue; peekLayers.add(layer); return layer; } @@ -2097,7 +2189,9 @@ export function createSidebarPeek(options: SidebarPeekOptions): SidebarPeek { // A menu can also be mounted directly under a resting cursor, which // fires no pointer event of its own, so the box under the pointer is // adopted here instead of only being looked up. - if ((peekLayerAt(hit) ?? adoptPeekLayer(hit)) !== null) return true; + if ((peekLayerAt(hit) ?? adoptPeekLayer(hit, VOUCHED_ADOPTION)) !== null) { + return true; + } // Gemini and Grok open through their own toggle, which sits outside the // rail. The pointer still rests on the control that opened the panel, so // the peek must not close underneath it. @@ -2109,7 +2203,15 @@ export function createSidebarPeek(options: SidebarPeekOptions): SidebarPeek { // sibling layer, a transparent overlay, or the blank space between two // rows. A miss there is the pointer crossing the panel, not leaving it, // so the peek's own geometry has the final say. - return withinPeekBand(current, pointerX, pointerY); + if (withinPeekBand(current, pointerX, pointerY)) return true; + // The pointer is in the gap between the panel and a menu it is using, or + // between that menu and its submenu. The gap is page content, but it is on + // the way to a box the peek already adopted, so it is still the peek. + return withinPeekLayers( + pointerX, + pointerY, + SIDEBAR_PEEK_APPROACH_MARGIN_PX, + ); } /** @@ -2141,7 +2243,7 @@ export function createSidebarPeek(options: SidebarPeekOptions): SidebarPeek { if (rail === null) { // A flyout the pointer just walked into from the panel is part of the // peek from here on, so hide nothing and keep the deadline unarmed. - if (adoptPeekLayer(target) !== null) { + if (adoptPeekLayer(target, VOUCHED_ADOPTION) !== null) { cancelHide(); return; } @@ -2187,7 +2289,10 @@ export function createSidebarPeek(options: SidebarPeekOptions): SidebarPeek { } // A flyout a site re-renders under the resting pointer arrives here as a // move rather than a pointerover; it is still the peek. - if (target instanceof Element && adoptPeekLayer(target) !== null) { + if ( + target instanceof Element && + adoptPeekLayer(target, VOUCHED_ADOPTION) !== null + ) { cancelHide(); return; } @@ -2290,7 +2395,10 @@ export function createSidebarPeek(options: SidebarPeekOptions): SidebarPeek { // Walking from the row menu into the submenu it opens is still the // peek: adopt the box the pointer is heading into instead of arming a // hide the pointer is about to outrun. - if (related instanceof Element && adoptPeekLayer(related) !== null) { + if ( + related instanceof Element && + adoptPeekLayer(related, DEPARTURE_ADOPTION) !== null + ) { cancelHide(); return; } @@ -2301,7 +2409,10 @@ export function createSidebarPeek(options: SidebarPeekOptions): SidebarPeek { // The box the pointer is heading into may be a flyout the page has not // given a pointer event yet: adopt it so the hide that follows finds the // pointer inside the peek. - if (related instanceof Element && adoptPeekLayer(related) !== null) { + if ( + related instanceof Element && + adoptPeekLayer(related, DEPARTURE_ADOPTION) !== null + ) { cancelHide(); return; } @@ -2352,7 +2463,7 @@ export function createSidebarPeek(options: SidebarPeekOptions): SidebarPeek { if ( !rail.contains(target) && peekLayerAt(target) === null && - adoptPeekLayer(target) === null + adoptPeekLayer(target, VOUCHED_ADOPTION) === null ) { return; } @@ -2425,7 +2536,7 @@ export function createSidebarPeek(options: SidebarPeekOptions): SidebarPeek { if ( active !== null && (peekLayerAt(target) !== null || - adoptPeekLayer(target) !== null || + adoptPeekLayer(target, VOUCHED_ADOPTION) !== null || popoverFor(target) !== null) ) { cancelHide(); diff --git a/tests/ai-chat-turbo-sidebar-peek.test.ts b/tests/ai-chat-turbo-sidebar-peek.test.ts index 7db1b56..c8a48cd 100644 --- a/tests/ai-chat-turbo-sidebar-peek.test.ts +++ b/tests/ai-chat-turbo-sidebar-peek.test.ts @@ -739,6 +739,165 @@ describe("sidebar hover peek", () => { } }); + /** + * A pointer crossing the gap between a row menu and its submenu fires moves + * on the page, not on either menu. A user who pauses in that gap is still + * using the menu, so the hide that the gap armed must find the pointer in + * the corridor next to a layer the peek already adopted. + */ + it("keeps the peek when the pointer pauses in the gap beside a menu", () => { + const instance = start(); + hoverButton(); + vi.advanceTimersByTime(SIDEBAR_PEEK_SHOW_DELAY_MS); + + const row = document.getElementById("history"); + if (!(row instanceof HTMLElement)) throw new Error("missing history row"); + stubNodeRect(row, 248, 32, 0); + const chat = document.getElementById("chat"); + if (!(chat instanceof HTMLElement)) throw new Error("missing chat"); + const menu = document.createElement("div"); + menu.style.position = "absolute"; + stubNodeRect(menu, 180, 120, 300); + const entry = document.createElement("button"); + entry.textContent = "Move to"; + menu.appendChild(entry); + document.body.appendChild(menu); + const restoreEntry = stubHit(entry); + + try { + dispatchPointer("pointerover", row, null, "mouse", 40, 100); + dispatchPointer("pointerout", row, entry, "mouse", 248, 100); + + const restoreGap = stubHit(chat); + try { + dispatchPointerMove(280, 100, chat); + } finally { + restoreGap(); + } + vi.advanceTimersByTime(SIDEBAR_PEEK_HIDE_DELAY_MS * 3); + expect(instance.isPeeking()).toBe(true); + + dispatchPointer("pointerover", entry, row, "mouse", 300, 100); + vi.advanceTimersByTime(SIDEBAR_PEEK_HIDE_DELAY_MS); + expect(instance.isPeeking()).toBe(true); + } finally { + restoreEntry(); + menu.remove(); + } + }); + + /** + * Sites pre-mount a row's menu in its final position and only fade it in, so + * the peek records it as a popover the page already owned before it was ever + * painted. When the same box opens, walking into it is still the peek. + */ + it("adopts a row menu the site parked transparent before the peek", () => { + const instance = start(); + const menu = document.createElement("div"); + menu.setAttribute("role", "menu"); + menu.style.position = "absolute"; + menu.style.opacity = "0"; + stubNodeRect(menu, 180, 120, 300); + const entry = document.createElement("button"); + entry.textContent = "Rename"; + menu.appendChild(entry); + document.body.appendChild(menu); + + hoverButton(); + vi.advanceTimersByTime(SIDEBAR_PEEK_SHOW_DELAY_MS); + expect(instance.isPeeking()).toBe(true); + + const row = document.getElementById("history"); + if (!(row instanceof HTMLElement)) throw new Error("missing history row"); + stubNodeRect(row, 248, 32, 0); + menu.style.opacity = "1"; + const restore = stubHit(entry); + + try { + dispatchPointer("pointerover", row, null, "mouse", 40, 100); + dispatchPointer("pointerout", row, entry, "mouse", 300, 100); + dispatchPointer("pointerover", entry, row, "mouse", 310, 100); + vi.advanceTimersByTime(SIDEBAR_PEEK_HIDE_DELAY_MS); + expect(instance.isPeeking()).toBe(true); + } finally { + restore(); + menu.remove(); + } + }); + + /** + * The same parking trick leaves the menu laid out past the viewport. It is + * not a box the user can see, so it must not be recorded as the page's own. + */ + it("adopts a row menu the site parked off screen before the peek", () => { + const instance = start(); + const menu = document.createElement("div"); + menu.setAttribute("role", "menu"); + menu.style.position = "absolute"; + stubNodeRect(menu, 180, 120, 2000); + const entry = document.createElement("button"); + entry.textContent = "Rename"; + menu.appendChild(entry); + document.body.appendChild(menu); + + hoverButton(); + vi.advanceTimersByTime(SIDEBAR_PEEK_SHOW_DELAY_MS); + + const row = document.getElementById("history"); + if (!(row instanceof HTMLElement)) throw new Error("missing history row"); + stubNodeRect(row, 248, 32, 0); + stubNodeRect(menu, 180, 120, 300); + const restore = stubHit(entry); + + try { + dispatchPointer("pointerover", row, null, "mouse", 40, 100); + dispatchPointer("pointerout", row, entry, "mouse", 300, 100); + dispatchPointer("pointerover", entry, row, "mouse", 310, 100); + vi.advanceTimersByTime(SIDEBAR_PEEK_HIDE_DELAY_MS); + expect(instance.isPeeking()).toBe(true); + } finally { + restore(); + menu.remove(); + } + }); + + /** + * A menu that was already on screen when the peek opened is normally page + * chrome, but the pointer walking out of the panel into that exact box names + * it as the peek's. Geometry still has to agree, so a dialog across the app + * stays the page's own. + */ + it("adopts the box a departure from the peek walks into", () => { + const instance = start(); + const menu = document.createElement("div"); + menu.setAttribute("role", "menu"); + menu.style.position = "absolute"; + stubNodeRect(menu, 180, 120, 300); + const entry = document.createElement("button"); + entry.textContent = "Rename"; + menu.appendChild(entry); + document.body.appendChild(menu); + + hoverButton(); + vi.advanceTimersByTime(SIDEBAR_PEEK_SHOW_DELAY_MS); + + const row = document.getElementById("history"); + if (!(row instanceof HTMLElement)) throw new Error("missing history row"); + stubNodeRect(row, 248, 32, 0); + const restore = stubHit(entry); + + try { + dispatchPointer("pointerover", row, null, "mouse", 40, 100); + dispatchPointer("pointerout", row, entry, "mouse", 300, 100); + dispatchPointer("pointerover", entry, row, "mouse", 310, 100); + vi.advanceTimersByTime(SIDEBAR_PEEK_HIDE_DELAY_MS); + expect(instance.isPeeking()).toBe(true); + } finally { + restore(); + menu.remove(); + } + }); + /** * Page chrome is often a fixed wrapper that does not contain the rail. It is * not a flyout: adopting it would keep the panel open for as long as the From 31ad0b21e463347d1fd9c20f135f9591b782adec Mon Sep 17 00:00:00 2001 From: Yoko Date: Fri, 4 Dec 2026 20:19:56 +0800 Subject: [PATCH 2/2] chore(ai-chat-turbo-engine): release 0.23.20 --- docs/ai-chat-turbo-engine.md | 12 ++++++++++-- scripts/ai-chat-turbo-engine/meta.ts | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/ai-chat-turbo-engine.md b/docs/ai-chat-turbo-engine.md index 64d32ac..f57ca66 100644 --- a/docs/ai-chat-turbo-engine.md +++ b/docs/ai-chat-turbo-engine.md @@ -2,7 +2,7 @@ 面向长对话与重度使用的跨平台 AI 聊天增强用户脚本。在受支持的 AI 对话页面上叠加一层轻量增强,解决四类实际痛点:长会话渲染变卡、超长代码块挤占阅读空间、大段文本撑爆输入框、上下文难以迁移到新会话。 -当前版本:**0.23.19** +当前版本:**0.23.20** 许可证:**MIT** 运行方式:单文件用户脚本,无外部依赖,无网络请求,不申请任何 GM 权限。 @@ -135,7 +135,7 @@ contain-intrinsic-size: auto var(--turbo-cached-h, 120px); - **脚本只碰必要的内联值。** ChatGPT 的展开面板常驻 DOM,但滚动区带内联的隐藏声明,样式表压不过它,因此探出模块按快照临时抬起该声明、收回时原样写回;这是唯一需要改内联样式的情况,同样不复制节点。 - **内容不再被内层容器裁掉。** 有些站点把面板内容挂在按折叠宽度写死的容器上,只加宽导轨会出现「导轨变宽了、标签仍被裁」的半截状态。平台在 `sidebar.shells` 里列出这些容器(ChatGPT 的 `#app-shell-sidebar`、Gemini 的 `bard-sidenav` 等),探出时同时给 `width` / `min-width` / `max-width` 写探出宽度,收回时按内联快照逐条还原;基础规则也带 `min-width`、`max-width` 与 `box-sizing: border-box`,避免站点自己的 `max-width` 把加宽压回去。 - **中间空隙不会打断探出。** 面板内容可能画在导轨之外的兄弟层里,指针经过这些空白区域时 `elementFromPoint` 命中的是空白、透明遮罩或别的节点。探出期间改用几何包含判断:导轨自身加宽后的矩形,加上所有被拉伸的 shell 矩形,指针落在其中任一处都算仍在面板上;真正离开这条带才进入 160ms 的收回宽限。 -- **历史行菜单与挂在它下面的子菜单算作面板。** 二级菜单由站点画在导轨之外:有的挂到 body,有的挂在行旁边的定位层里,多数还不带 `role`,既不在导轨子树内,也命中不了弹层选择器,于是从行上滑进菜单就被当成离开面板,按下 160ms 宽限收回。现在探出把「面板画在哪」当成唯一依据:认领指针要从面板进去的那层脱离文档流的壳,只接受处于 `absolute` / `fixed` / `sticky` 或自带弹层语义、不包含导轨、且宽度小于视口 60% 的外层(页面的应用外壳在文档流里,不在其列;视口级的固定壳同样按宽度排除)。认定依据有两条,都不看时间:菜单的矩形与探出所画区域(导轨加宽后的带、被拉伸的 shell、已认领的层)相距 **32px** 以内,或者菜单的矩形正罩住指针(站点在指针停住时把菜单挂到光标下面,这种情况下它不产生任何指针事件)。已认领的菜单本身会加入这块区域,所以它弹出的子菜单、子菜单再弹出的下一层都依次相邻可认,跨过两框之间几像素空隙也不受影响。页面自己原有的弹层不认领,被站点销毁的层也随之失效,因此不会把页面上顺手打开的菜单粘在探出上。从认领层离开同样算「离开面板」,照旧走 160ms 宽限。 +- **历史行菜单与挂在它下面的子菜单算作面板。** 二级菜单由站点画在导轨之外:有的挂到 body,有的挂在行旁边的定位层里,多数还不带 `role`,既不在导轨子树内,也命中不了弹层选择器,于是从行上滑进菜单就被当成离开面板,按下 160ms 宽限收回。现在探出把「面板画在哪」当成唯一依据:认领指针要从面板进去的那层脱离文档流的壳,只接受处于 `absolute` / `fixed` / `sticky` 或自带弹层语义、不包含导轨、且宽度小于视口 60% 的外层(页面的应用外壳在文档流里,不在其列;视口级的固定壳同样按宽度排除)。认定依据有两条,都不看时间:菜单的矩形与探出所画区域(导轨加宽后的带、被拉伸的 shell、已认领的层)相距 **96px** 以内,或者菜单的矩形正罩住指针(站点在指针停住时把菜单挂到光标下面,这种情况下它不产生任何指针事件)。**96px** 是给交接留的余量:行菜单与它弹出的子菜单之间常隔 40px 以上,32px 的邻居阈值会漏掉这次交接。指针停在两个已认领的框之间、命中页面空白时,只要仍在已认领层 **96px** 的走廊内,也算还在面板上,因此慢慢跨过空隙不会触发收回。指针本身也参与认定:落在指针下的窄浮层、以及 `pointerout` 明确指向的目标,即使站点早就把菜单按最终位置预挂好(透明或排在视口外)、因而被记成「页面原有弹层」,也按指针的走向认领。已认领的菜单本身会加入这块区域,所以它弹出的子菜单、子菜单再弹出的下一层都依次相邻可认。页面自己原有的弹层不认领,被站点销毁的层也随之失效,因此不会把页面上顺手打开的菜单粘在探出上。从认领层离开同样算「离开面板」,照旧走 160ms 宽限。 - **导航后立刻退场。** 点击探出面板里的历史条目会由站点自己换路由并重建导航,此时再点一次原生折叠按钮,会命中新路由下的另一个控件,并与页面自己的过渡抢时序,表现就是收回极慢。探出在点击捕获阶段就撤销,且记录「打开时按下的是哪个原生控件」,路由或文档变化后不再按下它;`popstate` / `hashchange`、导轨被替换、`location.href` 与打开时不一致,都走同一条无动画退场路径。 - **状态以站点为准。** 站点自己展开侧栏、节点被替换、或者按下原生开关时,探出属性立即撤销;在原生开关上按 Enter / 空格、Esc、在侧栏外按下指针也会立即收回。触屏与手写笔指针不触发。 - **其余平台默认关闭。** 只有 PLATFORMS 中声明了 sidebar 的平台启用,未声明的平台不注册任何监听。豆包与元宝用 transform 把侧栏整体移出容器,千问折叠后导航节点直接消失,纯 CSS 加宽不可行;Grok 与 Poe 走站点自己的开合控件。 @@ -524,6 +524,14 @@ pointerdown → mousedown → pointerup → mouseup → click ## 版本记录 +### 0.23.20 + +**继续修悬停探出在历史记录二级菜单上误收回:这次补的是上一版仍然漏掉的三种情况。** + +- **空隙按 96px 交接,不再只认 32px。** 行菜单与它弹出的子菜单之间常隔 40px 以上,上一版的邻居阈值漏掉这次交接;指针在这个空隙里还会命中页面空白,把收回宽限点着。现在 `pointerout` 指向的目标按 **96px** 认定,指针停在两个已认领框之间时,只要仍在已认领层 **96px** 的走廊内就算还在面板上,跨得慢一点也不会收回。 +- **预挂菜单不再被当成页面原有弹层。** 站点常把行菜单提前按最终位置挂好、用透明或排在视口外的方式藏着,上一版的快照把它记成页面自己的弹层,真正打开后仍被永久拒绝。现在计算样式的透明与视口外矩形都不计入快照;并且指针落进去、或 `pointerout` 明确指向它时,指针本身就为这层作保,快照不再否决。 +- **测试覆盖。** 新增「指针停在同一菜单旁的空隙里超过宽限」「预挂为透明的菜单在打开后被认领」「预挂到视口外的菜单在移回后被认领」「离开探出时指针走向的已存在浮层被认领」四条用例;这四条在上一版代码上全部失败,现在全部通过,原有探出用例保持通过。 + ### 0.23.19 **修好上一版仍未修掉的问题:指针滑进历史记录的二级菜单(以及它的下一级)时,侧边栏还是会自己缩回去。** diff --git a/scripts/ai-chat-turbo-engine/meta.ts b/scripts/ai-chat-turbo-engine/meta.ts index dd1789c..191eec8 100644 --- a/scripts/ai-chat-turbo-engine/meta.ts +++ b/scripts/ai-chat-turbo-engine/meta.ts @@ -4,7 +4,7 @@ import { PLATFORM_MATCH_PATTERNS } from "./src/config"; const meta = { name: "AI Chat Turbo Engine", namespace: "https://cyojkoy.github.io/Payment/", - version: "0.23.19", + version: "0.23.20", description: "跨平台 AI 对话加速:常驻统计 + 完整消息提取 + YAML 交接 + 多平台适配 + 长代码折叠 + 自适应脱水 + 推理强度记忆 + 元宝原子工具记忆 + 新对话快捷键覆盖", author: "Yoko", updateURL: "https://cdn.jsdelivr.net/gh/CYoJkoY/Yoko-ScriptCat-Scripts@release/ai-chat-turbo-engine.user.js",