Files
dsh-worktable/01_content/template/dshell.html
T
super-agent 4dd3a8c785 feat(theme): 恢复主题桥,工作台页重新跟随 DSH 深浅色 (REQ-20261117-0013)
问题:Gitea 0.5.x 线缺了 qiudl 0.4.x 分支的整套主题桥能力,升级后所有工作台
产物页都不再跟随 DSH 主题(浅色/深色/跟随系统全部失效),页面各自锁死自己的配色。
这是升级引入的真实回归,比单个页面的配色问题严重得多。

移植内容(来自 qiudl 0.4.9-rc.2,theme.ts 无外部依赖,纯函数 + 浏览器脚本):
- 新增 src/theme.ts(191 行):THEME_BRIDGE_JS / injectThemeBridge / 前缀判定
- 模板路由补 /api/worktable/template/theme.js(独立打开/嵌套 iframe 显式引用)
- 站点路由对 .html/.htm 自动注入主题桥(幂等:已含 data-wt-theme-bridge 则原样)
- 新增 04_test/theme-bridge.test.mjs(7 个回归用例,含接线防漏)

顺带修两处写死项(同属「不跟随主题」根因):
- dshell.css::root{color-scheme:dark} → color-scheme:light dark + 浅/深两套
  兜底 token(历史事故:写死深色会让所有页面锁死深色)
- dshell.css:正文字体改走 var(--dsw-font-family, ...)

版本 0.5.3-local.3 -> 0.5.3-local.4

验证:build 通过;client-factory-gate 10/10;主题桥测试 7/7;兼容回归 105/105;
release-prep 全过(结构断言、独立安装 import、split anchor dom 14 场景、
sidebar popup、真实 Chromium split margin 5 场景、server home 3 场景)
2026-11-18 15:03:50 +08:00

82 lines
3.1 KiB
HTML

<!doctype html>
<!-- dsh-worktable 原生皮肤模板:新页面以此为基础,替换下面示例内容即可。
样式表由插件提供(随主题自动适配),不要复制或改写它。 -->
<html lang="zh-CN">
<head>
<!-- 主题跟随:站点路由(/api/worktable/site/**)已自动注入主题桥,无需手写;
独立打开 / 嵌套 iframe 时显式引入下面这一行即可:
<script src="/api/worktable/template/theme.js"></script> -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>我的窗口</title>
<link rel="stylesheet" href="/api/worktable/template/dshell.css" />
</head>
<body>
<div class="dshell">
<!-- 标题区 -->
<h1 class="dshell-title">窗口标题</h1>
<p class="dshell-sub">一句话说明这个窗口做什么。</p>
<!-- 状态徽标:已完成 dshell-badgeDone / 进行中 dshell-badgeWait / 默认 -->
<div>
<span class="dshell-badge dshell-badgeDone">已完成</span>
<span class="dshell-badge dshell-badgeWait">进行中</span>
<span class="dshell-badge">未开始</span>
</div>
<!-- 标签页 -->
<div class="dshell-tabs">
<button class="dshell-tab dshell-tabOn">概览</button>
<button class="dshell-tab">详情</button>
<button class="dshell-tab">设置</button>
</div>
<!-- 统计卡片网格 -->
<div class="dshell-grid">
<div class="dshell-stat">
<div class="dshell-statLabel">总数</div>
<div class="dshell-statValue">128</div>
<div class="dshell-statDelta">+12.4%</div>
</div>
<div class="dshell-stat">
<div class="dshell-statLabel">进行中</div>
<div class="dshell-statValue">7</div>
</div>
<div class="dshell-stat">
<div class="dshell-statLabel">已完成</div>
<div class="dshell-statValue">121</div>
</div>
</div>
<!-- 列表 -->
<div class="dshell-list">
<div class="dshell-listItem">
<span class="dshell-listItemTitle">条目一:示例内容标题</span>
<span class="dshell-listItemMeta">昨天</span>
</div>
<div class="dshell-listItem">
<span class="dshell-listItemTitle">条目二:示例内容标题</span>
<span class="dshell-badge dshell-badgeDone">已发布</span>
</div>
</div>
<!-- 卡片 + 键值对 -->
<div class="dshell-card">
<h2 class="dshell-sub" style="margin:0 0 8px">详情</h2>
<div class="dshell-kv">
<div class="dshell-kvRow"><span class="dshell-kvKey">字段 A</span><span class="dshell-kvValue">值 A</span></div>
<div class="dshell-kvRow"><span class="dshell-kvKey">字段 B</span><span class="dshell-kvValue">值 B</span></div>
</div>
<div class="dshell-divider"></div>
<div class="dshell-progress"><div class="dshell-progressBar" style="width:72%"></div></div>
</div>
<!-- 操作区 -->
<div style="display:flex;gap:8px">
<button class="dshell-btn">主要操作</button>
<button class="dshell-btn dshell-btnGhost">次要操作</button>
</div>
</div>
</body>
</html>