feat(ui): 控制室图标改内联 SVG,替代系统 emoji (v0.5.3-local.9)

emoji 的渲染完全取决于系统字体(Windows Segoe UI Emoji / macOS Apple Color
Emoji 的形状与配色都不同),同一份代码在不同机器上长得不一样,观感也偏旧
(截图里的 🖥️ 呈老式 CRT 显示器样式)。

- 新增 ICON_CONSOLE 内联 SVG(显示器 + 支架,stroke=currentColor)
- 侧栏控制室卡片改用该图标
- .dsh-wt_layoutIcon 改为定尺寸 flex 容器;新增 .dsh-wt_layoutSvg 跟随主题色,
  选中态取强调色

用户自定义图标选择器(EMOJI_SET)保留不动 —— 那是功能,不是默认值。

验证:npm run pack 全绿,双资产同源 sha256 888d4e8f…。
This commit is contained in:
wangheng
2026-12-02 17:43:58 +08:00
parent b917f0e0ed
commit 6aa0d3dce4
9 changed files with 44 additions and 19 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ export function hostPreviewUrl(
/** Keep update instructions on the active profile; Desktop must use its bundled CLI. */
// 本仓发布在自建 Gitea:它不支持 GitHub 的 /releases/latest/download 简写,
// 安装命令必须带具体 tag。这里给固定 tag(随发布更新),避免给出 404 的命令。
const UPDATE_TGZ = 'https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download/v0.5.3-local.8/dsh-worktable.tgz'
const UPDATE_TGZ = 'https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download/v0.5.3-local.9/dsh-worktable.tgz'
export function worktableUpgrade(protocol = typeof location === 'undefined' ? 'http:' : location.protocol) {
const desktop = protocol === 'dsh-app:'
+15 -1
View File
@@ -566,6 +566,20 @@ async function ensureSessionModel(sessionId: string): Promise<void> {
const CONSOLE_ID = 'wt-console'
const CONSOLE_ICON = '🖥️'
/**
* 控制室图标:内联 SVG 替代 emoji。
* emoji 的渲染完全取决于系统字体(Windows Segoe UI Emoji / macOS Apple Color Emoji
* 形状与配色都不同),同一份代码在不同机器上长得不一样,看起来也偏旧。
* 用 currentColor 描边图标可跟随主题色,两平台一致。
*/
const ICON_CONSOLE = (
<svg className="dsh-wt_layoutSvg" viewBox="0 0 16 16" fill="none" aria-hidden="true">
<rect x="1.6" y="2.2" width="12.8" height="8.6" rx="1.5" stroke="currentColor" strokeWidth="1.3" />
<path d="M5.2 13.4h5.6" stroke="currentColor" strokeWidth="1.3" strokeLinecap="round" />
<path d="M8 10.8v2.6" stroke="currentColor" strokeWidth="1.3" strokeLinecap="round" />
</svg>
)
/** 控制室布局是否健全:主窗格首格存在 console 类型标签(旧版关标签的坏存档没有它) */
function specHasConsoleTab(spec: LayoutSpec | undefined): boolean {
return !!spec?.main?.[0]?.tabs?.some((t) => t.content?.kind === 'builtin' && t.content.type === 'console')
@@ -3241,7 +3255,7 @@ function buildCustomLayoutPrompt(req: string): string {
title={t('console.name')}
onClick={(e) => clickConsoleCard(e.currentTarget as HTMLElement)}
>
<span className="dsh-wt_layoutIcon">{CONSOLE_ICON}</span>
<span className="dsh-wt_layoutIcon">{ICON_CONSOLE}</span>
<span className="dsh-wt_layoutText">
<span className="dsh-wt_layoutName">{t('console.name')}</span>
</span>
+4 -1
View File
@@ -234,7 +234,10 @@ export const css = xtermCss + '\n' + [
'.dsh-wt_layout:hover{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05))}',
'.dsh-wt_layout[data-on=true]{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05))}',
'.dsh-wt_layout[data-on=true] .dsh-wt_layoutName{color:var(--dsw-alias-state-accent-primary,#4f8ef7)}',
'.dsh-wt_layoutIcon{flex:none;font-size:15px}',
'.dsh-wt_layoutIcon{flex:none;font-size:15px;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px}',
// 内联 SVG 图标:跟随文字色,两平台渲染一致(emoji 依赖系统字体,形状/配色不统一)
'.dsh-wt_layoutSvg{width:15px;height:15px;display:block;flex:none;color:var(--dsw-alias-label-secondary,#9aa4b2)}',
'.dsh-wt_layout[data-on=true] .dsh-wt_layoutSvg{color:var(--dsw-alias-state-accent-primary,#4f8ef7)}',
'.dsh-wt_layoutText{flex:1;min-width:0;display:flex;flex-direction:column;gap:0}',
'.dsh-wt_layoutName{font-size:12px;font-weight:400;line-height:17px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
// 箭头与项目名同一行高 + 字面中心对齐;› 墨迹在字面框内偏下,整体上移 1px 使视觉居中