From 6def3edaed03376083c7dce12d814bbb87285697 Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Wed, 8 Jul 2026 00:10:57 +0800 Subject: [PATCH] =?UTF-8?q?feat(ds-flow):=20Phase=201.4=20=E2=80=94=20?= =?UTF-8?q?=E5=8E=9F=E5=9E=8B=E5=9B=BE=E6=A0=87=20SVG=20sprite=20=E5=8D=95?= =?UTF-8?q?=E6=BA=90=20icons.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit design/prototype/icons.js:57 个 Lucide 图标的 SVG sprite 单源(零依赖,注入 隐藏 + ,用法 )。 路径全部来自权威来源、零手写:35 个取自 usercenter icons.tsx 内联路径、 22 个从 web/website/node_modules/lucide-react 包提取。覆盖三处并集 (usercenter 全键 ∪ Flutter pangolin_icons.dart ∪ website lucide 用量); 别名(loader-circle/chart-no-axes-column/play-circle/more-vertical 等)已解析。 供 Phase 2 check-l1-sync ③「三端图标 ⊆ 原型 sprite」同源闸校验。 Co-Authored-By: Claude Opus 4.8 --- design/prototype/icons.js | 100 ++++++++++++++++++ .../plans/2026-07-07-frontend-ds-refactor.md | 2 +- 2 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 design/prototype/icons.js diff --git a/design/prototype/icons.js b/design/prototype/icons.js new file mode 100644 index 0000000..2f93c4b --- /dev/null +++ b/design/prototype/icons.js @@ -0,0 +1,100 @@ +// icons.js — SVG sprite 单源(Lucide 细线条,viewBox 0 0 24 24 / stroke-width 2 / 圆角端点,ISC 许可)。 +// 用法:;.ic{ width/height/color } 即可控制尺寸与颜色。 +// 收敛三处分散的 Lucide 图标为一份权威 sprite: +// · usercenter —— web/usercenter/components/icons.tsx 的内联路径(权威副本,逐字照抄)。 +// · lucide-react —— web/website/node_modules/lucide-react(usercenter 没有的从包源提取)。 +// 新增图标先在此登记 symbol,再用 引用;勿手写/瞎猜路径。 +(function () { + // key = kebab-name,value = 该图标的 lucide 子元素串(照搬权威来源)。 + var ICONS = { + // ── 源自 usercenter(web/usercenter/components/icons.tsx 内联,逐字照抄)── + 'layout-dashboard': '', + 'link': '', + 'ticket': '', + 'users': '', + 'copy': '', + 'refresh-cw': '', + 'qr-code': '', + 'download': '', + 'check': '', + 'check-circle': '', + 'zap': '', + 'clock': '', + 'shield-check': '', + 'shield': '', + 'crown': '', + 'credit-card': '', + 'send': '', + 'message-circle': '', + 'mail': '', + 'shopping-bag': '', + 'log-out': '', + 'external-link': '', + 'gift': '', + 'smartphone': '', + 'lock': '', + 'chevron-right': '', + 'arrow-down': '', + 'settings': '', + 'trash-2': '', + 'monitor': '', + 'key': '', + 'sun': '', + 'moon': '', + 'alert-triangle': '', + 'x': '', + + // ── 源自 lucide-react 包(web/website/node_modules/lucide-react v0.469.0,usercenter 未含)── + 'power': '', + 'loader-circle': '', + 'globe': '', + 'user': '', + 'search': '', + 'chevron-down': '', + 'arrow-left': '', + 'arrow-up': '', + 'arrow-right': '', + 'compass': '', + 'chart-no-axes-column': '', + 'map-pin': '', + 'laptop': '', + 'monitor-smartphone': '', + 'play-circle': '', + 'wifi': '', + 'eye': '', + 'eye-off': '', + 'more-vertical': '', + 'pencil': '', + 'terminal': '', + 'menu': '' + }; + + // 组装隐藏 sprite:每个图标一个 ,符号上带 lucide 标准描边属性,故 .ic 只需管 width/height/color。 + function buildSprite() { + var parts = [''); + return parts.join(''); + } + + function inject() { + if (document.getElementById('pangolin-icon-sprite')) return; + var d = document.createElement('div'); + d.id = 'pangolin-icon-sprite'; + d.style.cssText = 'position:absolute;width:0;height:0'; + d.innerHTML = buildSprite(); + document.body.insertBefore(d, document.body.firstChild); + } + + if (document.readyState !== 'loading') inject(); + else document.addEventListener('DOMContentLoaded', inject); + + // 便于调试/校验:暴露原始映射。 + if (typeof window !== 'undefined') window.PANGOLIN_ICONS = ICONS; +})(); diff --git a/docs/superpowers/plans/2026-07-07-frontend-ds-refactor.md b/docs/superpowers/plans/2026-07-07-frontend-ds-refactor.md index f6f6643..a89488b 100644 --- a/docs/superpowers/plans/2026-07-07-frontend-ds-refactor.md +++ b/docs/superpowers/plans/2026-07-07-frontend-ds-refactor.md @@ -43,7 +43,7 @@ **保持数值不变**,只重排为 ds-flow 结构;`colors_and_type.css` 作为兼容别名或迁移为薄封装(不破坏现有 codegen) - [x] 1.3 `design/prototype/atoms.css`:把按钮/卡片/输入/**语言下拉**/徽章/状态药丸等公用原子类沉淀为 只引 `var(--token)` 的 CSS(镜像 `design/preview/` 现有规格 + client widgets 实现语义) -- [ ] 1.4 `design/prototype/icons.js`:SVG sprite 单源(``), +- [x] 1.4 `design/prototype/icons.js`:SVG sprite 单源(``), 收敛现有分散图标(website Icon.astro / usercenter icons.tsx / Flutter pangolin_icons.dart 三处的图标集) - [ ] 1.5 `design/prototype/index.html`:活登记页——三…两主题(light/dark)切换 + `data-swatches` 声明式色板 + 字号梯度 + 圆角/间距/阴影 + 全部公用组件原子展示卡 + 图标库全展示。**每个 atom 必须在此登记**