feat(guide): let a tab type declare its own line in the new-tab list

The native new-tab list rendered one generic line ("opens in the DSH
sidebar") under every plugin entry, so six plugin rows read identically.
`TabDescriptor.description` now carries the real purpose (string or
locale-following thunk; absent falls back to the generic line), and the
six visible builtins declare theirs across all 20 dictionaries.

- service.ts: `TabDescriptor.description` + docs (guide §4.1, §0 row).
- native/: the guide entry's description follows the descriptor; the
  `files` takeover reuses the editor's line.
- builtins: files / changes / tasks / side chat / terminal / browser.
- tests: builtins assert every visible type declares a distinct line;
  the lifecycle test asserts descriptor lines (and the takeover reuse).
This commit is contained in:
Menghuan1918 committed 2026-09-09 22:25:59 +08:00
1 parent 9ebaa09f80
commit d4765819c0
26 files changed
+186 -5

No files matched your search

+8
View File
@@ -162,6 +162,14 @@ export interface TabDescriptor {
/** Unique id; also the `SidebarTab.type` value (`'explorer'`, `'my-plugin:db'`). */
id: string
title: string | (() => string)
/**
* One-line description of what this tab shows, rendered under the title in
* the host's new-tab list (DSH's native right Sidebar guide page). Without
* it the entry falls back to a generic "opens in the DSH sidebar" line, so
* every plugin page reads the same — declare the real purpose instead.
* Evaluated at render time, so a function follows the active locale.
*/
description?: string | (() => string)
icon?: ReactNode | ((size: number) => ReactNode)
/** + menu sort order (ascending); default 100. */
order?: number