feat: native DSH skin template (dshell.css/html served at /api/worktable/template) + knowledge pack mandates it for generated HTML

This commit is contained in:
Aisland
2026-08-19 23:54:26 +08:00
parent a4d5646f1d
commit 30b694341b
7 changed files with 202 additions and 0 deletions
+74
View File
@@ -0,0 +1,74 @@
/* dsh-worktable 原生皮肤 · DSH 设计系统组件库
用法:<link rel="stylesheet" href="/api/worktable/template/dshell.css">
所有颜色走 DSH 主题变量(--dsw-alias-*),自动适配明暗主题。 */
:root { color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
background: var(--dsw-alias-bg-base, #0b0e14);
color: var(--dsw-alias-label-primary, #e6e8eb);
font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
font-size: 13px;
line-height: 1.6;
}
.dshell { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; min-height: 100%; }
/* 文字层级 */
.dshell-title { margin: 0; font-size: 16px; font-weight: 600; color: var(--dsw-alias-label-primary, #e6e8eb); }
.dshell-sub { margin: 0; font-size: 12px; color: var(--dsw-alias-label-secondary, #9aa4b2); }
.dshell-muted { color: var(--dsw-alias-label-tertiary, #6b7280); font-size: 11.5px; }
/* 卡片 */
.dshell-card { border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 10px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.02)); padding: 12px 14px; }
.dshell-card + .dshell-card { margin-top: 10px; }
/* 按钮(绿色主按钮 / 幽灵按钮 / 危险) */
.dshell-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; border: 1px solid transparent; background: #3fb950; color: #0b0e14; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.dshell-btn:hover { filter: brightness(1.08); }
.dshell-btnGhost { background: transparent; border-color: var(--dsw-alias-border-l1, #262b36); color: var(--dsw-alias-label-secondary, #9aa4b2); }
.dshell-btnGhost:hover { color: var(--dsw-alias-label-primary, #e6e8eb); border-color: var(--dsw-alias-border-l2, #3a4150); }
.dshell-btnDanger { background: transparent; border-color: #f85149; color: #f85149; }
/* 状态徽标(圆点 + 文字;绿=已完成 黄=待办/待发布 灰=未开始) */
.dshell-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--dsw-alias-border-l1, #262b36); font-size: 11.5px; color: var(--dsw-alias-label-secondary, #9aa4b2); background: var(--dsw-alias-fill-l1, rgba(255,255,255,.03)); }
.dshell-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--dsw-alias-label-tertiary, #6b7280); }
.dshell-badgeDone { color: #3fb950; border-color: rgba(63,185,80,.4); }
.dshell-badgeDone::before { background: #3fb950; box-shadow: 0 0 5px #3fb950; }
.dshell-badgeWait { color: #d29922; border-color: rgba(210,153,34,.4); }
.dshell-badgeWait::before { background: #d29922; box-shadow: 0 0 5px #d29922; }
.dshell-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dsw-alias-label-tertiary, #6b7280); }
.dshell-dotDone { background: #3fb950; box-shadow: 0 0 5px #3fb950; }
.dshell-dotWait { background: #d29922; box-shadow: 0 0 5px #d29922; }
/* 标签页 */
.dshell-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--dsw-alias-border-l1, #262b36); }
.dshell-tab { padding: 7px 12px; font-size: 12.5px; color: var(--dsw-alias-label-secondary, #9aa4b2); cursor: pointer; border: none; background: none; font: inherit; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.dshell-tabOn { color: var(--dsw-alias-label-primary, #e6e8eb); border-bottom-color: var(--dsw-alias-state-accent-primary, #4f8ef7); }
/* 列表 */
.dshell-list { display: flex; flex-direction: column; gap: 6px; }
.dshell-listItem { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 8px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.02)); cursor: pointer; }
.dshell-listItem:hover { border-color: var(--dsw-alias-border-l2, #3a4150); background: var(--dsw-alias-fill-l1, rgba(255,255,255,.05)); }
.dshell-listItemTitle { font-size: 12.5px; color: var(--dsw-alias-label-primary, #e6e8eb); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dshell-listItemMeta { flex: none; font-size: 11px; color: var(--dsw-alias-label-tertiary, #6b7280); }
/* 网格 / 统计 */
.dshell-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.dshell-stat { padding: 10px 12px; border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 10px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.02)); }
.dshell-statLabel { font-size: 11px; color: var(--dsw-alias-label-secondary, #9aa4b2); }
.dshell-statValue { font-size: 20px; font-weight: 600; color: var(--dsw-alias-label-primary, #e6e8eb); }
.dshell-statDelta { font-size: 11px; color: #3fb950; }
/* 进度条 */
.dshell-progress { height: 6px; border-radius: 3px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.06)); overflow: hidden; }
.dshell-progressBar { height: 100%; border-radius: 3px; background: #3fb950; }
/* 输入 */
.dshell-input, .dshell-textarea { width: 100%; padding: 7px 10px; border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 8px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.03)); color: var(--dsw-alias-label-primary, #e6e8eb); font: inherit; font-size: 12.5px; outline: none; }
.dshell-input:focus, .dshell-textarea:focus { border-color: var(--dsw-alias-state-accent-primary, #4f8ef7); }
/* 表格 */
.dshell-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dshell-table th, .dshell-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--dsw-alias-border-l1, #262b36); }
.dshell-table th { color: var(--dsw-alias-label-secondary, #9aa4b2); font-weight: 500; }
/* 键值对 */
.dshell-kv { display: flex; flex-direction: column; gap: 6px; }
.dshell-kvRow { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.dshell-kvKey { color: var(--dsw-alias-label-secondary, #9aa4b2); }
.dshell-kvValue { color: var(--dsw-alias-label-primary, #e6e8eb); text-align: right; }
/* 分割线 */
.dshell-divider { height: 1px; background: var(--dsw-alias-border-l1, #262b36); margin: 6px 0; }
/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }
+78
View File
@@ -0,0 +1,78 @@
<!doctype html>
<!-- dsh-worktable 原生皮肤模板:新页面以此为基础,替换下面示例内容即可。
样式表由插件提供(随主题自动适配),不要复制或改写它。 -->
<html lang="zh-CN">
<head>
<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>