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:
@@ -32,10 +32,10 @@
|
||||
'<span class="conv-title">' + esc(s.title || s.id) + '</span>' + drawerStatusDot(s) +
|
||||
'</button>' +
|
||||
'<button class="conv-pop" data-pop="' + esc(s.id) + '" title="在新窗口打开" aria-label="在新窗口打开">' +
|
||||
'<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>' +
|
||||
'<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#i-external"/></svg>' +
|
||||
'</button>' +
|
||||
'<button class="conv-del" data-del="' + esc(s.id) + '" title="删除会话" aria-label="删除会话">' +
|
||||
'<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>' +
|
||||
'<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>' +
|
||||
'</button>' +
|
||||
'</div>';
|
||||
}
|
||||
@@ -814,7 +814,7 @@
|
||||
wrap.innerHTML =
|
||||
'<div class="modal">' +
|
||||
'<button class="modal-close-btn" data-act="cancel" aria-label="关闭">' +
|
||||
'<svg viewBox="0 0 24 24"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>' +
|
||||
'<svg viewBox="0 0 24 24"><use href="#i-x-line-b"/></svg>' +
|
||||
'</button>' +
|
||||
'<h3 id="compress-modal-title">压缩上下文</h3>' +
|
||||
'<div class="modal-body" style="font-size:14px;line-height:1.55;color:#555;padding:4px 0 12px;">' +
|
||||
|
||||
Reference in New Issue
Block a user