From 96602d6a7e6eff45a4f1cb86ac8a0bc8483fa0fc Mon Sep 17 00:00:00 2001 From: Elegy233 <82034747+wan0ge@users.noreply.github.com> Date: Sat, 12 Sep 2026 07:51:27 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ui):=20=E5=89=8D=E7=AB=AF=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E7=BB=9F=E4=B8=80=E4=B8=BA=E8=87=AA=E7=BB=98=E7=BA=BF?= =?UTF-8?q?=E6=80=A7=20SVG=20=E5=9B=BE=E6=A0=87=EF=BC=8C=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E5=8E=9F=E6=9C=89=20emoji=20=E5=9B=BE=E6=A0=87=20(#473)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(ui): 界面图标统一为自绘线性 SVG 图标,替换原有 emoji 图标 界面中充当图标的 emoji 除底部彩色的 TG 链接外,全部替换为统一的线性图标。新增 ui/js/icons.js 图标库(32 个图标,24×24 网格、2px 圆头描边),以 SVG sprite 内联于 页面并通过 引用;图标尺寸随所在文字字号缩放,描边取 currentColor,颜色随容器、 八种强调色主题与明暗模式适配。 - 按钮、配置分类导航、搜索分组标题、状态行、徽标与映射行的图标全部替换 - 图标与文字并列处改用 flex 容器居中对齐 - 「重新部署」使用云与上行箭头,「弹幕配置」使用评论气泡 - 合并模式徽标切换改为只更新标签文本 - 为 .confirm-merge-btn:disabled 设置文字颜色 * refactor(ui): 配置分类导航统一渲染并补齐配置界面细节 - 映射表编辑界面(TITLE_MAPPING_TABLE、AUTO_MATCH_MAPPING_TABLE)增加「查看最近数据」按钮,仅查看缓存、不参与自动填充 - 配置预览与环境变量配置的分类按钮、搜索分组标题统一为同一渲染函数,消除两份平行实现 - 页头「当前版本」「最新版本」「API 端点」徽标补齐图标并对齐风格,当前版本为主视觉、最新版本为次要 - 各样式表头注释中「ACG 设计系统」描述改为「柔和圆角设计风格」 * feat(ui): 映射表查看数据入口调整与移动端头部、徽标动效优化 - 映射表编辑界面「查看最近数据」按钮移到「添加映射项」右侧并右对齐 - 移动端主标题「LogVar弹幕API」放大,突出主标题层级 - 「最新版本」徽标改为持续呼吸缩放动效,引导点击而不盖过「当前版本」 * feat(ui): 移动端标题微调、系统配置按钮缩小并补充弹幕词库贡献者 - 移动端主标题字号调整为 21px - 移动端系统配置的导出/导入/清理缓存/重新部署按钮缩小 - 弹幕词库新增贡献者 @xlmc、@mz289、@sugarbliss --- danmu_api/ui/css/base.css.js | 54 ++++----------- danmu_api/ui/css/components.css.js | 39 +++++++++-- danmu_api/ui/css/responsive.css.js | 4 +- danmu_api/ui/css/themes.css.js | 5 +- danmu_api/ui/js/icons.js | 107 +++++++++++++++++++++++++++++ danmu_api/ui/js/main.js | 3 +- danmu_api/ui/js/preview.js | 68 +++++++++--------- danmu_api/ui/js/systemsettings.js | 106 ++++++++++++++-------------- danmu_api/ui/template.js | 27 ++++---- 9 files changed, 262 insertions(+), 151 deletions(-) create mode 100644 danmu_api/ui/js/icons.js diff --git a/danmu_api/ui/css/base.css.js b/danmu_api/ui/css/base.css.js index 5274652..b114770 100644 --- a/danmu_api/ui/css/base.css.js +++ b/danmu_api/ui/css/base.css.js @@ -1,6 +1,6 @@ // language=CSS export const baseCssContent = /* css */ ` -/* 基础布局样式 — 参照 Bangumi-syncer 设计系统 */ +/* 基础布局样式 — 参照 Bangumi-syncer 柔和圆角设计风格 */ /* ============ 全局重置 ============ */ * { @@ -206,8 +206,8 @@ body::before { } .version-badge { - background: var(--theme-accent-soft); - color: var(--theme-accent); + background: var(--theme-accent); + color: #ffffff; padding: 3px 12px; border-radius: 999px; font-weight: 600; @@ -219,16 +219,16 @@ body::before { } .update-badge { - background: var(--theme-accent); - color: #ffffff; + background: var(--theme-accent-soft); + color: var(--theme-accent); padding: 3px 12px; border-radius: 999px; font-weight: 600; font-size: 11px; - animation: pulse 2s infinite; cursor: pointer; text-decoration: none; - transition: transform 0.2s ease, box-shadow 0.2s ease; + animation: badge-breathe 2.4s ease-in-out infinite; + transition: box-shadow 0.2s ease; position: relative; z-index: 1; -webkit-backdrop-filter: blur(8px); @@ -236,10 +236,14 @@ body::before { } .update-badge:hover { - transform: scale(1.04); box-shadow: var(--app-shadow-sm); } +@keyframes badge-breathe { + 0%, 100% { transform: scale(1); } + 50% { transform: scale(1.05); } +} + .api-endpoint-badge { background: rgba(107, 138, 255, 0.10); color: #6B8AFF; @@ -254,11 +258,6 @@ body::before { backdrop-filter: blur(8px); } -@keyframes pulse { - 0%, 100% { opacity: 1; } - 50% { opacity: 0.6; } -} - /* ============ 内容区 ============ */ .content { padding: 24px 28px; @@ -376,32 +375,5 @@ body::before { } } -@media (max-width: 768px) { - body { - padding: 0; - } - - .container { - border-radius: 0; - box-shadow: none; - } - - .header { - padding: 12px 14px; - } - - .content { - padding: 16px; - } - - .logo { - width: 36px; - height: 36px; - font-size: 20px; - } - - .header h1 { - font-size: 17px; - } -} `; + diff --git a/danmu_api/ui/css/components.css.js b/danmu_api/ui/css/components.css.js index 9948ccf..3ed383a 100644 --- a/danmu_api/ui/css/components.css.js +++ b/danmu_api/ui/css/components.css.js @@ -1,6 +1,30 @@ // language=CSS export const componentsCssContent = /* css */ ` -/* 组件样式 — 参照 Bangumi-syncer ACG 设计系统 */ +/* 组件样式 — 参照 Bangumi-syncer 柔和圆角设计风格 */ + +/* ============ 图标 ============ */ +/* 统一线性图标:尺寸随字号(1em),描边取 currentColor */ +.ui-icon-sprite { + position: absolute; + width: 0; + height: 0; + overflow: hidden; +} + +.ui-icon { + display: inline-block; + flex: none; + width: 1em; + height: 1em; + vertical-align: -0.125em; +} + +/* 图标与文字成对出现时的对齐容器(flex 居中) */ +.ui-icon-label { + display: inline-flex; + align-items: center; + gap: 0.4em; +} /* ============ 标签导航 ============ */ .nav-buttons { @@ -152,7 +176,10 @@ export const componentsCssContent = /* css */ ` font-size: 13px; font-weight: 500; transition: all 0.22s var(--app-ease-smooth); - display: inline-block; + display: inline-flex; + align-items: center; + justify-content: center; + gap: 6px; text-align: center; line-height: 1.4; } @@ -705,7 +732,7 @@ body[data-theme] .favorite-schedule-btn:disabled:hover { display: grid; place-items: center; color: var(--theme-muted); - font-size: 24px; + font-size: 16px; line-height: 1; } @@ -716,7 +743,7 @@ body[data-theme] .favorite-schedule-btn:disabled:hover { .preview-group-heading { min-height: 32px; display: flex; - align-items: baseline; + align-items: center; justify-content: space-between; gap: 10px; padding: 0 2px 8px; @@ -826,6 +853,9 @@ body[data-theme] .favorite-schedule-btn:disabled:hover { .preview-copy-btn { padding: 0; + display: inline-flex; + align-items: center; + justify-content: center; font-size: 16px; } @@ -1737,6 +1767,7 @@ body[data-theme] input[type="checkbox"].app-checkbox:focus-visible { .confirm-merge-btn:disabled { background: var(--theme-panel-strong); + color: var(--theme-muted); cursor: not-allowed; box-shadow: none; } diff --git a/danmu_api/ui/css/responsive.css.js b/danmu_api/ui/css/responsive.css.js index b37dd84..60bc415 100644 --- a/danmu_api/ui/css/responsive.css.js +++ b/danmu_api/ui/css/responsive.css.js @@ -49,7 +49,7 @@ export const responsiveCssContent = /* css */ ` } .header h1 { - font-size: 19px; + font-size: 21px; margin: 0; } @@ -214,7 +214,7 @@ export const responsiveCssContent = /* css */ ` /* ============ 小屏手机 (<= 480px) ============ */ @media (max-width: 480px) { .header h1 { - font-size: 18px; + font-size: 21px; } .nav-btn { diff --git a/danmu_api/ui/css/themes.css.js b/danmu_api/ui/css/themes.css.js index 1d63d32..95d5e8e 100644 --- a/danmu_api/ui/css/themes.css.js +++ b/danmu_api/ui/css/themes.css.js @@ -1,6 +1,6 @@ // language=CSS export const themesCssContent = /* css */ ` -/* 设计令牌与 ACG 七色主题 + 独立明暗切换 — 参照 Bangumi-syncer 设计系统 */ +/* 设计令牌与七色主题 + 独立明暗切换 — 参照 Bangumi-syncer 柔和圆角设计风格 */ /* ============ 全局设计令牌 ============ */ :root { @@ -216,7 +216,6 @@ body[data-theme] .theme-option:focus-visible, body[data-theme] .btn:focus-visibl .theme-option-label { font-size: 11px; font-weight: 600; white-space: nowrap; } .config-transfer-btn { display: inline-flex; align-items: center; gap: 7px; } .env-toolbar-actions .btn { align-items: center; display: inline-flex; justify-content: center; gap: 7px; line-height: 1.2; min-height: 38px; white-space: nowrap; } -.config-transfer-icon { font-size: 20px; font-weight: 700; line-height: 1; } /* ============ 自定义滚动条 ============ */ ::-webkit-scrollbar { width: 8px; height: 8px; } @@ -235,7 +234,7 @@ body[data-color-scheme="dark"] #bg-danmaku-layer span { opacity: 0.08 !important .env-section-header { align-items: stretch !important; } .env-section-header > div:first-child { min-width: 0; width: 100%; } .env-toolbar-actions { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; } - .env-toolbar-actions .btn { flex: none; min-height: 44px; padding: 10px 8px; width: 100%; } + .env-toolbar-actions .btn { flex: none; min-height: 34px; padding: 6px 10px; width: 100%; } .theme-settings { align-items: stretch; flex-direction: column; } .theme-options { grid-template-columns: repeat(3, minmax(0, 1fr)); } } diff --git a/danmu_api/ui/js/icons.js b/danmu_api/ui/js/icons.js new file mode 100644 index 0000000..f179640 --- /dev/null +++ b/danmu_api/ui/js/icons.js @@ -0,0 +1,107 @@ +// language=JavaScript +// 界面图标库:集中定义界面使用的线性图标,统一 24×24 网格、2px 圆头描边。 +// UI_ICON_PATHS —— 图标名到 SVG 图形的映射; +// iconsSpriteContent —— 内联 SVG sprite,供 引用; +// renderIcon / iconJsContent —— 分别供服务端模板与浏览器动态内容生成 引用。 +// 图标颜色与尺寸统一由 components.css.js 的 .ui-icon 控制。 + +// 图标几何数据:名称 -> symbol 内部图形 +const UI_ICON_PATHS = { + // ===== 明暗模式切换 ===== + // 太阳:明暗切换按钮在暗色模式下显示 + sun: '', + // 月亮:明暗切换按钮在亮色模式下显示 + moon: '', + + // ===== 状态提示 ===== + // 星光:页头「最新版本」徽标 + sparkles: '', + // 标签:页头「当前版本」徽标 + tag: '', + // 警告三角:配置获取失败、Cookie/API Key 未配置、检测失败 + 'alert-triangle': '', + // 成功圆:已登录、扫码登录成功、连通性测试通过 + 'check-circle': '', + // 失败圆:Cookie 失效、二维码过期、连通性测试失败 + 'x-circle': '', + // 时钟:等待扫码、正在生成二维码 + clock: '', + + // ===== 通用操作 ===== + // 刷新:刷新日志、刷新请求记录 + 'refresh-cw': '', + // 垃圾桶:清空日志、清理缓存 + 'trash-2': '', + // 上传(托盘 + 向上箭头):导出配置文件 + upload: '', + // 下载(托盘 + 向下箭头):导入配置文件 + download: '', + // 云 + 上行箭头:重新部署系统 + 'cloud-up': '', + // 复制:复制配置值 + copy: '', + // 软盘:Bilibili Cookie 待保存提示 + save: '', + + // ===== 勾选与方向 ===== + // 对勾:复制成功、合并确认、映射「匹配」状态 + check: '', + // 叉:映射「落单」状态 + x: '', + // 向上箭头:数字步进器增大 + 'chevron-up': '', + // 向下箭头:数字步进器减小 + 'chevron-down': '', + // 向右箭头:总览卡片进入指示 + 'chevron-right': '', + + // ===== 导航与分类 ===== + // 链接:API 配置分类、开启合并模式、被合并源数量徽标 + link: '', + // 断开链接:关闭合并模式 + unlink: '', + // 叠层:源配置分类 + layers: '', + // 放大镜:匹配配置分类、检测中状态 + search: '', + // 评论气泡(方形 + 文本行):弹幕配置分类 + comment: '', + // 数据库(圆柱):缓存配置分类 + database: '', + // 齿轮:系统配置分类 + settings: '', + // 四宫格:配置总览按钮 + 'layout-grid': '', + // 列表:展开 / 收起映射详情 + list: '', + // 柱状图:查看最近数据 + 'bar-chart': '', + // 胶片:剧集数量徽标 + film: '', + // 二维码:扫码登录 + 'qr-code': '', + // 锥形瓶:AI API Key 连通性测试 + flask: '', +}; + +// 内联 SVG sprite:集中所有 定义,供 引用 +export const iconsSpriteContent = ``; + +// 服务端模板用(template.js 在 Node 中拼接 HTML 时调用):生成引用 sprite 的图标 +export function renderIcon(name, className = 'ui-icon') { + return ``; +} + +// 浏览器动态内容用(注入页面
- +
@@ -67,12 +69,12 @@ export const HTML_TEMPLATE = /* html */ `

LogVar弹幕API

- 当前版本: v${globals.version} + ${renderIcon('tag')} 当前版本: v${globals.version} - 🎉 最新版本: 加载中... + ${renderIcon('sparkles')} 最新版本: 加载中... - API端点: 加载中... + ${renderIcon('link')} API端点: 加载中...
@@ -93,7 +95,7 @@ export const HTML_TEMPLATE = /* html */ `

配置预览