diff --git a/CHANGELOG.md b/CHANGELOG.md index f7fe5dd6..6cb9b110 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ - 🪟 **桌面壳里开启沙箱的 HTML 预览不再空白(403)**:壳只给 origin 为 `dsh-app://app` 的子帧注入转发标记,沙箱 iframe 是不透明源,主文档导航直接被壳拒绝。现在顶层可信帧取回 HTML 与同源静态资源,内联成自包含文档后交给 sandboxed `blob:` iframe;相对 CSS/JS/图片/字体正常,iframe 仍无 `allow-same-origin`,浏览器与“关闭沙箱”路径不变。嵌套 iframe / Worker / 脚本运行时相对请求仍受壳限制。 - 🧪 测试:`tests/html-preview-frame.spec.tsx`、`tests/html-preview-inline.spec.ts`、`tests/sandbox-views.spec.tsx`、`test:mount` 的本地图片断言。 -- 🧭 **开始页由插件接管,支持两列自适应、可配置行数和「更多」收纳**:右侧栏展开时不再用宿主自带的单列卡片页。宽屏(≥520px)每行两张、窄屏一张;默认最多 6 行(可在设置中改为 ≥1 行),超出容量的入口收进「更多」卡片,菜单里可直接打开,也可打开「调整顺序」。开始页卡片点击后用新页面替换指南页,和宿主原行为一致。 +- 🧭 **开始页由插件接管,支持两列自适应、可配置行数和「更多」收纳**:右侧栏展开时不再用宿主自带的单列卡片页。宽屏(≥520px)每行两张、窄屏一张;默认最多 6 行(可在设置或「调整顺序」弹窗中改为 ≥1 行),超出容量的入口收进「更多」卡片,菜单行统一为图标 + 标题,可直接打开,也可打开「调整顺序」。开始页内容默认垂直居中,可切换为靠上;设置中新增「接管开始页」开关(默认开),关闭后恢复宿主自带开始页。开始页卡片点击后用新页面替换指南页,和宿主原行为一致。 - 🧪 测试:`tests/guide-layout.spec.ts`(排序 / 隐藏 / 列数与容量 / More 占格 / 最小容量)、`tests/native-guide.spec.tsx`(卡片、More、终端 Shell 菜单、catalog 订阅、chain 注册与释放)。 - 🗂 **设置里的「开始页」清单接管所有已注册到官方侧边栏的入口**:本插件、宿主终端和第三方 tab 都按 `providerId::entryId` 列出,默认显示;开关只隐藏开始页卡片,不注销 tab 类型,也不影响快捷键、资源打开或已打开页签。Better Sidebar 自己的功能开关语义不变。支持上移/下移和恢复默认顺序,排序持久化。 - 🧪 测试:`tests/side-card-section.spec.tsx`(原生入口清单、默认开启、顺序与隐藏状态)、`tests/prefs.spec.ts`(行数 / 顺序 / 可见性校验)。 diff --git a/CHANGELOG_EN.md b/CHANGELOG_EN.md index 90d46a0d..88f53e58 100644 --- a/CHANGELOG_EN.md +++ b/CHANGELOG_EN.md @@ -16,7 +16,7 @@ - 🪟 **A sandboxed HTML preview in the desktop shell no longer renders blank (403).** The shell injects its forwarding marker only into subframes whose origin is `dsh-app://app`; a sandboxed iframe is an opaque origin, so its main navigation is rejected before reaching the plugin. The trusted top frame now fetches the HTML and its same-origin static assets and frames a self-contained `blob:` document; relative CSS/JS/images/fonts work, the iframe still has no `allow-same-origin`, and the browser / explicitly-unsandboxed paths are unchanged. Nested iframes, Workers and relative requests made by previewed scripts at runtime remain subject to the shell's restriction. - 🧪 `tests/html-preview-frame.spec.tsx`, `tests/html-preview-inline.spec.ts`, `tests/sandbox-views.spec.tsx`, and the local-image assertion in `test:mount`. -- 🧭 **The start page is now plugin-owned, with a responsive two-column grid, a configurable row budget, and a More card for overflow.** Expanding the right sidebar no longer shows the host's single-column card page. Wide panes (>= 520px) put two cards on a row and narrow panes one; 6 rows by default (configurable to any value >= 1 in settings), and entries beyond the budget move into a More card whose menu opens them directly or opens "Reorder". Picking a card replaces the guide tab with the chosen page, exactly like the host did. +- 🧭 **The start page is now plugin-owned, with a responsive two-column grid, a configurable row budget, and a More card for overflow.** Expanding the right sidebar no longer shows the host's single-column card page. Wide panes (>= 520px) put two cards on a row and narrow panes one; 6 rows by default (configurable to any value >= 1 in settings or in the Reorder dialog), and entries beyond the budget move into a More card whose rows all carry an icon plus a title and open the entry or the Reorder dialog. The grid is vertically centered by default and can be pinned to the top; settings gain a default-on "Take over the start page" switch that restores the host's page when off. Picking a card replaces the guide tab with the chosen page, exactly like the host did. - 🧪 Tests: `tests/guide-layout.spec.ts` (ordering / visibility / columns and capacity / More occupancy / minimum capacity) and `tests/native-guide.spec.tsx` (cards, More, the terminal shell menu, catalog subscription, chain registration and release). - 🗂 **The settings "Start page" inventory now covers every entry registered with the official sidebar.** Plugin tabs, the host terminal, and third-party tabs are listed by `providerId::entryId`, visible by default; a switch only hides the start-page card and never unregisters a tab type, affects shortcuts, resource opens, or already-open tabs. Better Sidebar's own feature switches keep their meaning. Move up/down and reset order are supported and persisted. - 🧪 Tests: `tests/side-card-section.spec.tsx` (native inventory, default-on, order and visibility) and `tests/prefs.spec.ts` (rows / order / visibility validation). diff --git a/docs/external-plugin-guide.md b/docs/external-plugin-guide.md index 6d5a8168..b30adf23 100644 --- a/docs/external-plugin-guide.md +++ b/docs/external-plugin-guide.md @@ -42,7 +42,7 @@ | 底部终端的恢复语义(#774) | 刷新后重新上屏同一页签时,页面用**同一份 `(sessionId, key, contentId)`** 再次调用宿主的 `webTerminals.view()`:宿主持久化在 localStorage 的 `(sessionId, contentId) → 终端 id` 绑定因此把**同一个** PTY 认回来(`contentId` 是 `dsh-better-sidebar:terminal-bottom:`——**每个页签一个实例,不再是恒定值**,#926)。插件**不把 terminalId 写进 `tab.meta`**:`view()` 显式传 terminalId 会关掉宿主的「缺了就建」分支,一个过期的 id 会把页签永久卡在 `missingTerminal` 上。DSH 重启后 PTY 全没了而 localStorage 绑定还在,所以「新建终端」按钮把 `tab.meta.terminalRun` +1 换一代 `contentId`,让宿主另铸一个进程,而不是反复认领死绑定 | | 底部工作台的开合 | 落到底部工作台的打开一律展开它(新建与聚焦都算),因此 `openTab` 的落点永远可见;开合按钮注册在 DSH 会话头的 utilities 槽(`conversation.session.header.utilities`),不在插件自己的宿主里 | | 在侧边打开(`target: 'side'`,v0.22.0+) | 原生栏里的 tab **不在插件底部工作台的分栏树里**,所以「在侧边打开」不能写 `bottomSplits`(那样会落到用户没展开的底部工作台 = 点了没反应)。服务改为把这一步交给宿主:带 path 的 `editor` seed 走 `openResource(address, { preferNewPane: true, revealIfOpened: false })`——宿主先按自己的两格上限与空间规则尝试分栏,分不了才回退到当前格;`revealIfOpened: false` 允许与已打开的同名资源并存,因此对同一个文件再点一次也会新开一格。其余类型若传 `target: 'side'`,同样以 `preferNewPane` 落原生栏(组件型 tab 的 path 仍是组件种子)——**唯一的例外是 `bottomOnly` 类型**(#774):它没有原生承载面可落,`target: 'side'` 被改道回 `'bottom'`。path-less 的 `editor`(文件页)与 `'bottom'` 行为不变 | -| 开始页接管(v0.31 起) | 插件在 `sidebar.right.tab.guide` 注册一个恒选中的 chain 条目,自己绘制开始页:宽屏每行两张、窄屏一张,行数可配置(默认 6,最小 1),超出容量的卡片收进「更多」。设置页「侧边栏内容 → 开始页」列出**当前注册到官方的全部开始页入口**(本插件、宿主终端、第三方),默认全部显示;开关只隐藏开始页卡片,不注销 tab 类型。排序按 `providerId::entryId` 持久化。**第三方 guide 条目仍会出现,但其自定义卡片组件不会被复用**:`sidebar.right.tab.guide.entry` 由宿主 guide body 独占声明,chain 条目拿不到 `renderSlot`。当前官方只有终端的 TerminalGuide 是自定义卡片,插件通过 `ctx.webTerminals.launchShells` / `selectShell` 复刻其 Shell 菜单;其他自定义卡片显示为通用卡片。宿主 `MAX_DESCRIBED_ENTRIES` 的描述隐藏逻辑不再适用,插件卡片始终显示描述。 +| 开始页接管(v0.31 起) | 插件在 `sidebar.right.tab.guide` 注册一个恒选中的 chain 条目,自己绘制开始页:宽屏每行两张、窄屏一张,行数可配置(默认 6,最小 1,设置与「调整顺序」弹窗共用同一个输入组件),内容默认垂直居中、可切换靠上;设置中的「接管开始页」开关默认开,关闭后恢复宿主自带开始页。超出容量的卡片收进「更多」,菜单行为图标 + 标题。设置页「侧边栏内容 → 开始页」列出**当前注册到官方的全部开始页入口**(本插件、宿主终端、第三方),默认全部显示;开关只隐藏开始页卡片,不注销 tab 类型。排序按 `providerId::entryId` 持久化。**第三方 guide 条目仍会出现,但其自定义卡片组件不会被复用**:`sidebar.right.tab.guide.entry` 由宿主 guide body 独占声明,chain 条目拿不到 `renderSlot`。当前官方只有终端的 TerminalGuide 是自定义卡片,插件通过 `ctx.webTerminals.launchShells` / `selectShell` 复刻其 Shell 菜单;其他自定义卡片显示为通用卡片。宿主 `MAX_DESCRIBED_ENTRIES` 的描述隐藏逻辑不再适用,插件卡片始终显示描述。 | 新建标签页列表 | 每个 tab 类型在原生 guide 里占一行:标题取 `title` + 图标取 `icon`(缺图标时宿主补一个方块占位),说明取可选的 `description`——**宿主只在 guide 列出的条目 ≤ 4 条时渲染说明**(上游 `MAX_DESCRIBED_ENTRIES = 4`),更长的列表整列丢掉所有说明;未声明 `description` 的条目渲染成单行「图标 + 标题」(rc.1 起 `description` 回到宿主契约,但**宿主与插件都没有兜底句**,所以插件恢复字段而不恢复旧的通用句);`hidden: true` 的类型不占行,**`bottomOnly: true` 的类型同样不占行**(#774:它只活在插件自己的底部 `+` 菜单里)。插件的 `editor` 类型不再单独占行(它认领的文件资源由 `files` 接管页承载同一视图)。**本插件默认贡献 4 个 guide 条目**(文件 / Git / 任务管理 / 侧边对话,恰好在上限内),**但宿主的终端条目也占一行**——装了宿主终端即是 5 条,说明整列不渲染;要让说明回来,需在插件设置页关掉足够多的 tab 类型把总数压到 ≤ 4 条 | | 新建面板的种子(alpha.2) | 在新会话打开原生新面板时,宿主从已注册的 guide 条目里播种:恰好 1 个条目 → 直接打开那一页;0 或 ≥2 个条目 → 打开指南。`revealIfOpened` 打开的「页面」在**同一 pane 内**强制去重(已在该 pane 就不再新建);由已有 tab 地址驱动的打开不受该去重影响 | | alpha.2 全局面板(不接入) | 插件**不采用** alpha.2 引入的全局主面板模型——根级 keyed `main` 槽(预留 key `conversation`,由 ui-conversation 注册为 `main.conversation`)、根级 `sidebar.panellist` 列表槽(`SidebarPanelMetadata` / `SidebarPanelIconOwnerProps`)、`ctx.layout.selectPanel(MainPanelId|null)` / `beginNavigation()` / `dispose()`、全局标准 prop `usePanelInfo`,以及改根级并新增会话级 `rightbar.session` 子槽的 `rightbar`——这些只作兼容保留,不向其迁移 | diff --git a/docs/host-contracts.md b/docs/host-contracts.md index 79d43ecf..86be29a9 100644 --- a/docs/host-contracts.md +++ b/docs/host-contracts.md @@ -42,7 +42,7 @@ - `tab.visible` 语义是 `active && (...)`(全局面板 / 后台会话时 body 不挂载);持久化校验也收紧(非根 / 列轴 / 嵌套 / 3+ docked pane 的 split 一律判非法**整份丢弃**)。全局面板(根级 `main` keyed 槽 + `sidebar.panellist` + `ctx.layout.selectPanel/beginNavigation`、`rightbar` 改根级并新增 `rightbar.session`)插件**不接入**,只做兼容。底部工作台的中心列锚点认 `[data-slot="main.conversation"]`(并跳过 `display: contents` 祖先,同时保留 `[data-slot="conversation"]`)。原生 tab 体宿主 `.paneBody` 是**有确定高度的块级滚动容器**(非 flex 容器),native 适配层因此给每个 tab 体包一层 `height:100%` 的列 flex 宿主(`sidebar.module.css` 的 `.nativeTabHost`),tab 组件根继续用 `flex:1` / `height:100%`。 - **原生注册账本的两条不变量**(`tests/native-registration.spec.ts` 守护):① `live` 里同时装着描述符类型(键 = descriptor id)与 `files` 接管(键 = `FILES_KIND`,**永远不在 `wanted` 里**),清理循环必须**跳过 `FILES_KIND`**——它只由编辑器类型的 `wantsFiles/hasFiles` 开关分支与 seat disposer 管理;否则每次通知都会把它拆掉再重建,而 teardown 期间的那次重建会把 id 孤儿化:`tabs.register` 建在**宿主** ctx 上(宿主 ctx 此时仍活着)所以照样成功,紧随的 `ctx.slots.inject` 建在**插件** ctx 上却抛 `cannot create effect on inactive context`,`live.set` 永不执行 → 该 id 在整页生命周期内不可再注册(真机表现:`native register files error: … already registered` 刷屏 + 文件树落到宿主空态,只有刷新页面才恢复;实证见 [docs/plans/2026-09-28-native-files-takeover-reload-leak.md](plans/2026-09-28-native-files-takeover-reload-leak.md))。② 因此「注册成功一半」是**可达状态**:任何在宿主取走 id **之后**失败的注册(槽位注册抛错等)必须**回滚释放该 type** 并释放已经建好的槽位,插件侧只留一个下次通知可以重试的失败,绝不留下无处释放的 id。相关断言必须写在注册表的**事件日志**上而不是「活着的 id 集合」上:孤儿 id 会让键集合看起来完全正常,键集合断言在未修复代码上同样通过。 - **原生 tab 的状态保留(已采纳 `keepMounted: true`)**:宿主因此把访问过的 body 挂住,同会话切 tab 不再卸载,组件态(树滚动、未保存草稿、chip 重命名)随之免费保留,**不需要**任何 module-level 记忆。三条必须同时成立的配套事实:(a) **记录不能随卸载删除**(只由 `surface.close` 与「会话消失」回收),而「切回会话清零」那一路(真机日志里 `DISPOSE type …:files` → `register`、同键 `drop`+`mint`)已由上面的 `FILES_KIND` 守卫挡掉(真机 e2e 现断言跨会话 `scrollTop` 复原);(b) 原生 tab id **每会话各自计数**(`tab1`…)且多会话同号并存,记录与写面一律按 `sessionId::tabId` 记账,`Surface.update/has/activate` 的 `sessionId` 缺省按 `sidebarRight.mounted` 解析,多会话同名时**拒绝而不是猜**;(c) **展开集的权威在插件 store 的会话状态里**(`attachStore` + `syncExpanded` + `getSessionStates().expanded`,由 `native/index.ts` 绑定),记录只负责**身份**与投影——两套持久化会互相打架,插件不自持「每记录的展开集」。设计过程与实测见 [docs/plans/2026-09-25-native-tab-state-retention-keepmounted.md](plans/2026-09-25-native-tab-state-retention-keepmounted.md)。 - - **开始页接管(v0.31 起)**:插件注册 `sidebar.right.tab.guide` 的 chain 条目并恒选中,替换宿主 `GuideBody` 的卡片页;每个卡片保留 `data-sidebar-right-guide` / `data-sidebar-right-guide-entry` 选择器,另加 `data-dsh-guide-grid` 供真实宿主验收。chain 条目**无法**取得 `sidebar.right.tab.guide.entry` 的 `renderSlot`:该槽由宿主的 guide body 独占声明(一个 child key 只能有一个 declarer),所以宿主/第三方注册的自定义卡片组件不能在插件页面里复用。当前官方只有终端的 TerminalGuide 是自定义卡片,插件通过公开的 `ctx.webTerminals.launchShells` / `selectShell` 复刻其 Shell 菜单;其他自定义卡片降级为通用卡片。宿主 guide 的 compass hero、pin/More 行为与 `MAX_DESCRIBED_ENTRIES` 描述隐藏逻辑随接管失效,由插件自己的行数/可见性/排序取代。 + - **开始页接管(v0.31 起)**:插件注册 `sidebar.right.tab.guide` 的 chain 条目并恒选中,替换宿主 `GuideBody` 的卡片页(设置中的 `guideTakeover` 默认开,关闭即注销该 chain 条目、恢复宿主页面);每个卡片保留 `data-sidebar-right-guide` / `data-sidebar-right-guide-entry` 选择器,另加 `data-dsh-guide-grid` 供真实宿主验收。chain 条目**无法**取得 `sidebar.right.tab.guide.entry` 的 `renderSlot`:该槽由宿主的 guide body 独占声明(一个 child key 只能有一个 declarer),所以宿主/第三方注册的自定义卡片组件不能在插件页面里复用。当前官方只有终端的 TerminalGuide 是自定义卡片,插件通过公开的 `ctx.webTerminals.launchShells` / `selectShell` 复刻其 Shell 菜单;其他自定义卡片降级为通用卡片。宿主 guide 的 compass hero、pin/More 行为与 `MAX_DESCRIBED_ENTRIES` 描述隐藏逻辑随接管失效,由插件自己的行数/可见性/排序取代。 10. **自定义种子必须带 fork 标记对(`meta.isSeeded: true` + `inheritedEventCount`),且 create 后必须 `inbox.clear()`、冷恢复必须按 id 精确清扫——标记对必要但不充分**:dsh-session 契约规定「只给 seed 不标 isSeeded,种子算重放历史而非继承前缀」——缺标记时 `Session.ownEvents()` 含整个种子,子会话的 inbox 折重放种子里的 `agent/inbox/spliced`,**继承父会话切割时刻未领取的 inbox 输入**。**但运行时 inbox 不走 `ownEvents()`**:`ReactLoopInbox.current()` → `ctx.sessionProjections.stateOf()` → `SessionProjectionRegistry.cellFor` 折的是 `snapshotEvents()` **全量日志(含继承种子前缀)**,且标准 inbox 投影的 `init` 忽略 `inheritedEventCount`、注册表 `session/created` 急切初始化跳过一切种子会话(seq ≠ 0)——种子里的 `agent/inbox/spliced` 会原样重放进子会话 live inbox。因此 sidechat 宿主 `agents.create` 成功后、任何 inject/followup 之前必须 `handle.agent.inbox.clear()`(durable 补偿 splice 是 own 事件,冷恢复折存储日志同样归零)。**幽灵的来源比「父会话排队」更宽**:父会话 mid-turn 且工具有未返回调用时,种子被截断在 `turn/start` 之前,而 inbox 的「领取」splice 发生在 `turn/start` **之后** → **父会话本轮开头已领取的输入**在种子折叠里仍是 pending;`clear()` 是唯一能一次清干净的硬围栏(create 时本线程自己不可能有排队输入)。**冷恢复不能沿用 `clear()`**(会误杀「用户在线程里排队、宿主重启后尚未领取」的合法输入):改为 `dropInheritedGhosts`——`inheritedPendingIds(log, inheritedEventCount)` 只折继承前缀得到幽灵 id 集合,再逐个 `agent.inbox.remove(id)`,精确且幂等(`src/sidechat-core.ts` 纯函数,`tests/sidechat-core.spec.ts` / `tests/sidechat-routes.spec.ts` 守护)。宿主 `session.fork`(api-session-controller)的调用即规范形态(注意:宿主自己的 `fork` **没有**这一步补偿,同窗口有同样的暴露面);回归由 `tests/sidechat-seed-validation.spec.ts`(真实 `Session.create` + 对 `ownEvents()` 跑 inbox 折 + **真实 `SessionProjectionRegistry`** 折全量日志钉住上游洞与 clear 补偿)守护。**压缩种子的重编号必须连绝对 seq 引用一起重映射**:`session-log-deepseek/delivery-accepted` 的 `throughSeq` 是绝对 seq,v4 读取器要求它早于自己的标记(`delivery throughSeq must precede its marker`),漏映射会让子会话日志永久不可读、连带父会话 `includeDescendants` 导出失败(#1109);水位线落在被丢弃区间时整条记录丢弃(`src/sidechat-core.ts` 的 `rebaseEvent`,`tests/sidechat-compaction-seed.spec.ts` 守护)。**模型选择同为 agent 作用域**:`sidechat.model` 必须同时落 `session.append('model/selection', …)`(宿主 `selectForNextRequest` 的同一形状)与 `installModelSelection(agent.ctx, ref)`(`@deepseek-ai/dsh-agent` 公开导出),否则控制器缓存的 per-agent selection 永不回读投影;resume 后也要按日志里的有效选择重装(`src/sidechat-routes.ts` 的 `ensureModelSelection`)。**上游 0.2.0 新增的 `buildForkSeed` 与本插件手工的 `buildSidechatInheritance` 职责重叠,但收益不明确**(插件另有 dangling-tool-call 退回结构化快照的自有需求),暂不替换。 11. **`dsh.plugin.json` 从来不是 DSH 契约**(全树 grep 0 命中):DSH 真正读的是 `package.json` 的 `dsh.bundle.patch` + `dsh.client`(`platform`/`inject`/`immediately`/`external`)+ `exports["./client"]`。`dsh.plugin.json` 与 `lib/client-registry.js` 只服务第三方 registry(社区市场)通道,`tests/manifest-consistency.spec.ts` 守护的是这条通道的形状,不是 DSH 契约。**不要混淆两个 manifest 的 `engines.dsh`**:当前宿主的兼容性检查优先读取 `package.json#engines.dsh`,存在时由它独立裁决;本插件未声明此字段,仍由 14 条 DSH peer 决定兼容性。`dsh.plugin.json#engines.dsh` 只是第三方 registry 元数据,不能替代 package 字段;`dsh.manifestVersion` 也不是版本兼容性开关。`dsh.bundle.patch` 有形状校验(非法值会 `throw`,引导期跳过该 bundle),本插件是合法的单字符串。 diff --git a/src/client/SideCardSection.module.css b/src/client/SideCardSection.module.css index 29bdd383..ee1a3034 100644 --- a/src/client/SideCardSection.module.css +++ b/src/client/SideCardSection.module.css @@ -122,6 +122,44 @@ line-height: 18px; } +/* A compact two-option segmented control (vertical alignment). */ +.segmented { + display: inline-flex; + flex: none; + padding: 2px; + border: 1px solid var(--dsw-alias-border-l2); + border-radius: 8px; + background: var(--dsw-alias-bg-layer-2); +} + +.segment { + min-width: 48px; + padding: 4px 10px; + border: 0; + border-radius: 6px; + background: transparent; + color: var(--dsw-alias-label-secondary); + font: inherit; + font-size: 12px; + line-height: 18px; + cursor: pointer; +} + +.segment:hover { + color: var(--dsw-alias-label-primary); +} + +.segmentOn { + background: var(--dsw-alias-bg-layer-3); + color: var(--dsw-alias-label-primary); + box-shadow: inset 0 0 0 1px var(--dsw-alias-border-l2); +} + +.segment:focus-visible { + outline: 2px solid var(--dsw-alias-border-l4); + outline-offset: 2px; +} + /* The inventory count: a soft-accent pill (the versionBadgeTag token recipe) so the count reads as metadata, not as part of the heading text. */ .count { diff --git a/src/client/SideCardSection.tsx b/src/client/SideCardSection.tsx index 6e9eb3ec..ddc767ce 100644 --- a/src/client/SideCardSection.tsx +++ b/src/client/SideCardSection.tsx @@ -67,6 +67,7 @@ import type { SidebarStore } from './state.ts' import type { NativeGuideCatalog, NativeGuideEntry } from './native/guide-catalog.ts' import { orderGuideEntries } from './native/guide-layout.ts' import { GuideOrderList } from './native/guide-order.tsx' +import { GuideRowsInput } from './native/guide-rows.tsx' import type { BetterSidebarService, FileViewerDescriptor, @@ -771,14 +772,6 @@ export function SideCardSection({ store, service, guideCatalog }: SideCardSectio applyPref({ guideOrder: next }) } - /** Commit the maximum row count; an invalid value restores the stored one. */ - const commitGuideRows = (raw: string, input: HTMLInputElement): void => { - const parsed = Number(raw) - const next = Number.isSafeInteger(parsed) && parsed >= 1 ? parsed : prefs.guideRows - if (next !== prefs.guideRows) applyPref({ guideRows: next }) - input.value = String(next) - } - /** Flip one declaratively-declared toggle (a SidebarPrefs boolean field). */ const onToggleSetting = (toggle: SidebarSettingToggle, next: boolean): void => { applyPref({ [toggle.key]: next }) @@ -1036,25 +1029,48 @@ export function SideCardSection({ store, service, guideCatalog }: SideCardSectio {orderedGuide.length}

{t('settingsStartPageDesc')}

+
+ + {t('settingsGuideTakeoverTitle')} + {t('settingsGuideTakeoverDesc')} + + { applyPref({ guideTakeover: next }) }} + /> +
{t('settingsGuideRowsTitle')} {t('settingsGuideRowsDesc')} - { commitGuideRows(event.currentTarget.value, event.currentTarget) }} - onKeyDown={(event) => { - if (event.key === 'Enter') event.currentTarget.blur() - }} + { applyPref({ guideRows: next }) }} />
+
+ + {t('settingsGuideAlignTitle')} + {t('settingsGuideAlignDesc')} + + + {(['center', 'top'] as const).map(value => ( + + ))} + +
{t('guideOrder')} )} > +
+ + {t('settingsGuideRowsTitle')} + {t('settingsGuideRowsDesc')} + + +