refactor(ui): 全站 svg 图标收进 index.html 的 symbol sprite
前端 99 处 svg、56 个唯一图形(× 号 11 次、+ 号 6 次、复制与文档各 5 次), 43 处是纯冗余路径:改一个图标得在两三个文件里同步,加个新图标又要复制一份 path。 现在几何图形统一定义在 index.html 里的一份 sprite,引用写成 <svg 原属性><use href="#i-xxx"/></svg>——外层 class、尺寸、fill/stroke 原样保留, 所以大小和描边仍归各处 CSS 管(.ic / .tree-act svg / .files-fab svg),形状逐像素照搬。 脚本按几何指纹建映射,99 处全部命中,零未匹配;校验结果 symbol 56 个、 引用 99 处、无缺失、无未被引用、sprite 外无残留几何标签,JS 全部 node --check 通过。 同形但历史写法不同的(folder/folder-b/folder-c、x-line/x-line-b/x-path、eye/eye-sm 等) 各留一份 symbol,保证替换前后完全一致,后续要收敛只改引用指向即可。 sprite 容器用 position:absolute + 零尺寸,不用 display:none:后者在部分旧浏览器上 会让被引用的 symbol 也一并不渲染。 体积:index.html +6KB(sprite 定义),js 合计 -5.3KB,总量基本持平。
This commit is contained in:
@@ -99,8 +99,8 @@
|
||||
// 队列本身在服务端(engine.pendings),关页面/换设备/重连都不丢;这里只负责画。
|
||||
// 每条一行;只有队首有「干预 / 立即发送」,其余显示排队中(不能越过前一条先发)。
|
||||
// 两条操作各配一枚图标:笔=撤回编辑(正文退回输入框),垃圾桶=直接丢弃这条
|
||||
const SQ_EDIT_ICON = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"/></svg>';
|
||||
const SQ_TRASH_ICON = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18"/><path d="M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/></svg>';
|
||||
const SQ_EDIT_ICON = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><use href="#i-pencil-b"/></svg>';
|
||||
const SQ_TRASH_ICON = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><use href="#i-trash"/></svg>';
|
||||
|
||||
function renderSendQueue() {
|
||||
const box = $('send-queue');
|
||||
|
||||
Reference in New Issue
Block a user