diff --git a/.dsh-version.json b/.dsh-version.json index ab5eda1..83d02e4 100644 --- a/.dsh-version.json +++ b/.dsh-version.json @@ -484,7 +484,7 @@ ] }, "dsh-themes": { - "version": "0.1.0-alpha.35", + "version": "0.1.0-alpha.36", "rows": [ "themes" ], diff --git a/packages/dsh-themes/lib/client.js b/packages/dsh-themes/lib/client.js index 5cc6d6b..86e188d 100644 --- a/packages/dsh-themes/lib/client.js +++ b/packages/dsh-themes/lib/client.js @@ -254,7 +254,7 @@ window.__ModuleLoader__.load({ /** The slot id of the Themes occupant in the header utilities list. */ const THEMES_ID = 'dsh-themes' /** Version marker, logged at activation so a fresh bundle is easy to verify. */ - const PLUGIN_VERSION = '0.1.0-alpha.35' + const PLUGIN_VERSION = '0.1.0-alpha.36' /** The client service (@deepseek-ai/dsh-client-ui-theme) that owns the preference. */ const THEME_SERVICE = 'theme' /** @@ -1995,14 +1995,20 @@ body[data-ds-dark-theme] ::-webkit-scrollbar-thumb:hover{background-color:rgba(2 let tries = 0 const openSettings = () => { + // The Settings DOOR on the 0.2.2 line is the account menu's own row + // (`openSettings` is one of the props the account seat hands it). That + // menu is the "More" block at the foot of the bar, and its Settings row + // is what a person clicks by hand - so the band presses the same row + // first. The inline trigger is the fallback: a line that renders the + // settings seat in the foot (which `whenAccess('settings/describe')` + // gates) still has it. + if (openAccountRow(['Settings', '设置'])) return try { const sidebar = document.querySelector('.' + SIDEBAR_CLASS + '_root') if (sidebar === null) return - // The shipped settings trigger lives in the settings AREA of the foot; - // scoping to it first is what keeps this click from landing on some - // other dialog opener the sidebar may carry earlier in the DOM (the - // 0.2.2 sidebar has more than one `aria-haspopup="dialog"`). The - // whole-column search stays as the fallback for a line that moved it. + // Scoped to the settings area first: the 0.2.2 sidebar carries more + // than one `aria-haspopup="dialog"`, so a whole-column first match can + // land on another opener and the button appears dead. const area = sidebar.querySelector('.' + SIDEBAR_CLASS + '_settingsArea') const trigger = (area === null ? sidebar : area).querySelector('[aria-haspopup="dialog"]') if (trigger !== null && typeof trigger.click === 'function') trigger.click() @@ -2023,6 +2029,7 @@ body[data-ds-dark-theme] ::-webkit-scrollbar-thumb:hover{background-color:rgba(2 * listed: the pack ships an English UI, and a Chinese locale would say the * same thing in its own words. * @param labels - the row labels to try, in order. + * @returns whether a row (or the menu that carries it) was found. */ const openAccountRow = (labels) => { const findRow = () => { @@ -2038,13 +2045,13 @@ body[data-ds-dark-theme] ::-webkit-scrollbar-thumb:hover{background-color:rgba(2 const open = findRow() if (open !== null) { open.click() - return + return true } const sidebar = document.querySelector('.' + SIDEBAR_CLASS + '_root') - if (sidebar === null) return + if (sidebar === null) return false const area = sidebar.querySelector('.' + SIDEBAR_CLASS + '_settingsArea') const trigger = (area === null ? sidebar : area).querySelector('[aria-haspopup="menu"]') - if (trigger === null || typeof trigger.click !== 'function') return + if (trigger === null || typeof trigger.click !== 'function') return false trigger.click() // The menu is portalled on the frame after the click. const press = () => { @@ -2053,8 +2060,10 @@ body[data-ds-dark-theme] ::-webkit-scrollbar-thumb:hover{background-color:rgba(2 } if (typeof requestAnimationFrame === 'function') requestAnimationFrame(press) else setTimeout(press, 16) + return true } catch (err) { /* a control that moved is not worth an exception in a click handler */ + return false } } diff --git a/packages/dsh-themes/package.json b/packages/dsh-themes/package.json index bce9080..3e09284 100644 --- a/packages/dsh-themes/package.json +++ b/packages/dsh-themes/package.json @@ -1,6 +1,6 @@ { "name": "dsh-themes", - "version": "0.1.0-alpha.35", + "version": "0.1.0-alpha.36", "description": "Themes and header dress: the conversation header's own controls (page zoom, Screenshot, Themes, session-log download), the Nord/Monokai/Hacker/Cyber palettes, and the pack's appearance overrides - Markdown paper, the branding band, the account menu's Feedback row removed, and the right bar's resize seam.", "type": "module", "main": "lib/index.js", diff --git a/scripts/checks/check-client-bundles.mjs b/scripts/checks/check-client-bundles.mjs index e416a28..b4ff0c6 100644 --- a/scripts/checks/check-client-bundles.mjs +++ b/scripts/checks/check-client-bundles.mjs @@ -2020,6 +2020,13 @@ check( themesSource.includes("sidebar.querySelector('.' + SIDEBAR_CLASS + '_settingsArea')") && themesSource.includes("(area === null ? sidebar : area).querySelector('[aria-haspopup=\"dialog\"]')"), ) +// The 0.2.2 Settings door is the account menu's own row; the band presses that +// row first and falls back to the inline trigger only when no menu is reachable. +check( + 'Settings presses the account menu row before the inline trigger', + themesSource.includes("if (openAccountRow(['Settings', '\u8bbe\u7f6e'])) return") && + themesSource.indexOf("if (openAccountRow(['Settings'") < themesSource.indexOf("_settingsArea')"), +) // Feedback and Sign in are rows of the shipped account menu: the band opens that // menu and presses the row, so the actions stay the account seat's own. check(