feat(file-icon-theme): 可选彩色图标主题接线(懒加载 chunk + 设置开关 + i18n)
- 新 chunk `file-icons`(`lib/client-file-icons.js`,255 kB / gzip 90 kB):把数据表 注册成 `registerFileIcon` 描述符——按 glyph+color 归并,563 条规则 → 约 250 条注册; 目录规则只走 `folderNames`(只认领列出的目录,未列出的仍用内置 glyph)。 - `src/client/file-icon-theme.ts`:pref → loadChunk → 注册/注销,generation 守卫 丢弃「切换中途落地」的加载;chunk 拉取失败只 log,保持内置 glyph。 - pref `fileIconTheme`(默认 `'builtin'`,未知值按 builtin 处理)+ 设置页 「文件 → 文件图标」下拉(内置单色 / 彩色品牌图标)。 - chunk 名同步四处(chunk-loader / bundle-route / tsdown / manifest-consistency)+ `bundle-route.spec`;tsdown 为该 chunk 加 react-icons ESM alias——否则整包打进 6.4 MB,alias 后 255 kB。 - i18n:6 个新 key 镜像到全部 19 份词典(zh/en 之外),locale 键集守护通过。 - 皮肤契约:指南 §12 增豁免条款(品牌色是内容非 chrome,仅限该懒加载 chunk), AGENTS §5 同步;`tests/theme.spec.ts` 新增边界用例(核心图标模块零颜色字面量、 核心不静态 import 该 chunk)。 - 测试:`tests/file-icon-theme.spec.tsx` 7 例(loader 六态 + 真实数据三表注册); prefs 新增默认值/解析用例;builtins / prefs / plugin-shape / smoke 夹具补字段。 - 全量 `pnpm test` 失败集与 main 基线逐条一致(5 文件 / 26 例预存环境失败), 新增用例全绿;typecheck / lint / build / check:consumer-types 全通过。
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
* `browser:<n>` the same way (no quota). The editor IS the files window
|
||||
* (the old standalone explorer merged into it).
|
||||
*/
|
||||
import { IconCodeOutline16, IconFolderOpen16, IconNewChatOutline16, IconPanelLeftOutline16, IconThinkOutline16 } from '@deepseek-ai/dsh-client-ui-primitives'
|
||||
import { IconCodeOutline16, IconFolderOpen16, IconFolderOpenOutline16, IconNewChatOutline16, IconPanelLeftOutline16, IconSparkle16, IconThinkOutline16 } from '@deepseek-ai/dsh-client-ui-primitives'
|
||||
import type { Context } from '../../context-types.ts'
|
||||
import { allLeaves, isAgentTabId, type SidebarState } from '../state.ts'
|
||||
import { t } from '../locales.ts'
|
||||
@@ -121,6 +121,28 @@ export function builtinTabs(ctx: Context, options: BuiltinTabOptions = {}): read
|
||||
key: 'workspaceFence',
|
||||
title: () => t('settingsFenceTitle'),
|
||||
desc: () => t('settingsFenceDesc'),
|
||||
}, {
|
||||
// The file-icon theme: monochrome built-in glyphs (default) vs the
|
||||
// optional colored brand dataset, which is fetched from the lazy
|
||||
// `file-icons` chunk only when picked (see file-icon-theme.ts).
|
||||
key: 'fileIconTheme',
|
||||
type: 'select',
|
||||
title: () => t('settingsFileIconThemeTitle'),
|
||||
desc: () => t('settingsFileIconThemeDesc'),
|
||||
options: [
|
||||
{
|
||||
value: 'builtin',
|
||||
icon: (size: number) => <IconFolderOpenOutline16 size={size} />,
|
||||
title: () => t('settingsFileIconThemeBuiltin'),
|
||||
desc: () => t('settingsFileIconThemeBuiltinDesc'),
|
||||
},
|
||||
{
|
||||
value: 'colored',
|
||||
icon: (size: number) => <IconSparkle16 size={size} />,
|
||||
title: () => t('settingsFileIconThemeColored'),
|
||||
desc: () => t('settingsFileIconThemeColoredDesc'),
|
||||
},
|
||||
],
|
||||
}],
|
||||
render: ({ pluginSettings, updatePluginSetting }) => (
|
||||
<OpenWithSettings pluginSettings={pluginSettings} updatePluginSetting={updatePluginSetting} />
|
||||
|
||||
Reference in New Issue
Block a user