<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>WebComponents | 锤子前端</title><description>Now vibe coding, so learning hammer FE ?</description><link>https://channel.meo-ai.com</link><item><title>《设计系统应该默认就是快的》</title><link>https://channel.meo-ai.com/posts/730</link><guid isPermaLink="true">https://channel.meo-ai.com/posts/730</guid><pubDate>Thu, 29 Oct 2026 09:14:04 GMT</pubDate><content:encoded>&lt;span class=&quot;post-title-source&quot;&gt;《设计系统应该默认就是快的》&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;标签：&lt;br /&gt;&lt;a href=&quot;/search/result?q=%23%E5%89%8D%E7%AB%AF%E5%BC%80%E5%8F%91&quot; title=&quot;#前端开发&quot;&gt;#前端开发&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E8%AE%BE%E8%AE%A1%E7%B3%BB%E7%BB%9F%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96&quot; title=&quot;#设计系统性能优化&quot;&gt;#设计系统性能优化&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95&quot; title=&quot;#性能测试&quot;&gt;#性能测试&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E6%80%A7%E8%83%BD%E9%A2%84%E7%AE%97&quot; title=&quot;#性能预算&quot;&gt;#性能预算&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23WebComponents&quot; title=&quot;#WebComponents&quot;&gt;#WebComponents&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E7%BB%84%E4%BB%B6%E6%B8%B2%E6%9F%93%E4%BC%98%E5%8C%96&quot; title=&quot;#组件渲染优化&quot;&gt;#组件渲染优化&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;总结：&lt;br /&gt;这篇文章通过实测十大主流开源设计系统（Mantine、Ant Design、Material UI、React Spectrum、Carbon、Fluent、Web Awesome、UI5、Spectrum Web Components、Ionic），论证了性能应当与设计系统团队所重视的可达性（accessibility）平起平坐：底层组件的每一个性能修复，都会同时惠及所有基于该设计系统构建的应用。测试发现性能优劣并不取决于框架本身，而在于具体实现细节，作者还深入剖析了 Ionic、Ant Design、UI5、React Spectrum 等慢速组件的根因，并给出了可行的修复建议，最后提供了基于 Playwright 的自动化性能测试方案与「Fast by Default（默认即快）」的理念。&lt;br /&gt;&lt;br /&gt;文章要点：&lt;br /&gt;1. 浏览器的 JavaScript 主线程是所有层共用的，设计系统组件越慢，留给应用代码的余地就越小——修复一个设计系统组件的性能，等于同时提升所有依赖它的应用。&lt;br /&gt;2. 作者选取了十个基于不同框架（React、Lit、FAST、Stencil、SAP 自研框架）的设计系统，在 4 倍 CPU 降速、Chrome 155 环境下实测了两大典型场景：打开含 249 个国家的下拉选择器、一次性全选 100 个复选框。&lt;br /&gt;3. 实测结果差异巨大：国家选择器从最快 Fluent 的 61ms 到最慢 Ionic 的 1,266ms（比第二名慢 5 倍以上）；复选框从 Fluent 的 29ms 到 Ant Design 的 421ms——同一框架（如 React 或 Lit）内部差距同样悬殊，性能问题出在实现而非框架。&lt;br /&gt;4. 十个设计系统中只有 Spectrum Web Components 在每个 PR 上自动跑组件级性能基准，多数团队只检查包体积——但包体积与组件在页面上的响应速度并无直接关系。&lt;br /&gt;5. 作者逐一剖析了慢速根因：Ionic 因 Stencil 在无 shadow DOM 的场景下用 &lt;code&gt;appendChildSlotFix&lt;/code&gt; 模拟插槽、每次新增选项都要遍历全部既有子节点三次（O(n²)）；React Spectrum 因 React Aria 逐个清空高度再读取尺寸造成「布局抖动」；UI5 因隐藏弹层中预置全部 249 个选项，打开瞬间浏览器要一次性完成约 1500 个元素的样式计算；Ant Design 的慢则主要来自 100 个复选框同时触发的颜色渐变动画。&lt;br /&gt;6. 性能瓶颈各有解法：长列表用虚拟滚动（Ant Design 的做法值得借鉴，还为屏幕阅读器保留了高亮项的隐藏副本）；动画改由合成器线程运行的 opacity 渐变替代主线程上的颜色渐变；Stencil 可直接修复插槽回退内容的第三次检查，作者实测去掉后加 2000 个元素快约 7 倍。&lt;br /&gt;7. 作者分享了用 Playwright + Chrome DevTools 协议（CPU 降速 4 倍 + Long Animation Frames 长帧 API）编写组件性能测试的完整代码，包含「总耗时预算 300ms」和「最长无响应帧不超过 100ms」两条性能预算（performance budget），以及一条「选项翻倍时耗时增长不超过 2.5 倍」的防 O(n²) 回归测试。&lt;br /&gt;8. 落地的最佳实践是「默认就提供快的行为」：超过性能预算的列表自动切换虚拟化、复选框仅在被直接点击时才播放动画，并在文档中写明每个组件的测试数据规模上限，发布说明中给出修复前后的量化数据（如「500 个选项下打开从 300ms 降到 150ms」）。&lt;br /&gt;9. 以上测试代码已开源在 GitHub 仓库 design-system-performance-tests 中，可直接复制改造用于自己的设计系统，并附带 GitHub Actions 工作流实现每个 PR 自动跑性能测试。&lt;br /&gt;10. 文章结尾宣传了作者的新书《Fast by Default: Practical Performance Engineering》（Manning 早期访问版），把这套思路延伸到后端与移动端。&lt;br /&gt;&lt;br /&gt;URL：&lt;a href=&quot;https://denodell.com/blog/design-systems-should-be-fast-by-default&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;https://denodell.com/blog/design-systems-should-be-fast-by-default&quot;&gt;https://denodell.com/blog/design-systems-should-be-fast-by-default&lt;/a&gt;&lt;a class=&quot;tgme_widget_message_link_preview&quot; href=&quot;https://denodell.com/blog/design-systems-should-be-fast-by-default&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;If a design system’s components are slow to interact with, so are any apps built with it. I timed large dropdowns and checkbox lists in some popular design systems, worked out how to make the slow ones faster, and wrote tests that fail when they’re too slow.&quot;&gt;
  
  &lt;div class=&quot;link_preview_site_name accent_color&quot;&gt;Den Odell&lt;/div&gt;
  &lt;img class=&quot;link_preview_image&quot; alt=&quot;Design Systems Should Be Fast by Default&quot; src=&quot;/static/https://cdn4.telesco.pe/file/prwDcUJjanfw3iDWSDKbwkdZNnwMgqXd8jse5-sGrIQFZEQ-bM__2cCdCrCKuuMxJn8qbhJIz27feWIXXSJ4RzrlsYlA0KbHp-HDqYfd-XCo_hd1SFHnRsM0VKHnl6faIKdO3Ga2GjMP5NPqFysbIFdTXxI4IQ8sbshAgYrFsSX8KuwMxYAFyVjPKL7AMRowWXal7pJwDx3cCUyRUqdEyPKWxsgr5-_k1pGbKifxUOOqggDzd_sFGafjxxdFuTkkb3JRwMGQhTANx-8Mlia_Qqw7mYYIoG7WpJLcJT2ZKFKG6vPWDSvUSsh84ousi-MwLEF8zrTeP8bDLgBQ0p6tXQ.jpg&quot; width=&quot;1200&quot; height=&quot;630&quot; loading=&quot;eager&quot; /&gt;
  &lt;div class=&quot;link_preview_title&quot;&gt;Design Systems Should Be Fast by Default&lt;/div&gt;
  &lt;div class=&quot;link_preview_description&quot;&gt;If a design system’s components are slow to interact with, so are any apps built with it. I timed large dropdowns and checkbox lists in some popular design systems, worked out how to make the slow ones faster, and wrote tests that fail when they’re too slow.&lt;/div&gt;
&lt;/a&gt;</content:encoded></item><item><title>《Markdown SVG 渲染器：AI 辅助开发的实用小工具》</title><link>https://channel.meo-ai.com/posts/652</link><guid isPermaLink="true">https://channel.meo-ai.com/posts/652</guid><pubDate>Sat, 30 May 2026 09:06:14 GMT</pubDate><content:encoded>&lt;span class=&quot;post-title-source&quot;&gt;《Markdown SVG 渲染器：AI 辅助开发的实用小工具》&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;标签：&lt;a href=&quot;/search/result?q=%23%E5%89%8D%E7%AB%AF&quot; title=&quot;#前端&quot;&gt;#前端&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E5%B7%A5%E5%85%B7&quot; title=&quot;#工具&quot;&gt;#工具&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23Markdown&quot; title=&quot;#Markdown&quot;&gt;#Markdown&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23SVG&quot; title=&quot;#SVG&quot;&gt;#SVG&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23AI%E8%BE%85%E5%8A%A9%E7%BC%96%E7%A8%8B&quot; title=&quot;#AI辅助编程&quot;&gt;#AI辅助编程&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23SimonWillison&quot; title=&quot;#SimonWillison&quot;&gt;#SimonWillison&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23WebComponents&quot; title=&quot;#WebComponents&quot;&gt;#WebComponents&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;总结：&lt;br /&gt;&lt;br /&gt;Simon Willison 分享了他用 Claude Opus 4.8 和 GPT-5.5 辅助开发的一个轻量级 Markdown 渲染工具，核心亮点是对 SVG 代码块的特殊处理——不仅能渲染出图像，还提供「渲染图 / 源代码」双标签切换。该工具支持直接粘贴 Markdown、加载远程文件或 GitHub Gist，并用 Fragment URL 记录状态以便分享。整个项目从需求到安全加固完全由 AI 驱动，是「提示驱动开发」的又一实例。&lt;br /&gt;&lt;br /&gt;文章要点：&lt;br /&gt;&lt;br /&gt;1. 这个工具的诞生源于一个具体场景：Simon 用 LLM CLI 让 Claude Opus 4.8 生成了五组不同思考深度（low 到 max）的「鹈鹕骑自行车」SVG，想找个优雅的方式展示这些 Markdown 日志&lt;br /&gt;2. 核心定制点在于 SVG 围栏代码块（\&lt;code&gt;\&lt;/code&gt;\`svg）——普通 Markdown 渲染器只会显示代码，而这个工具会把它变成可交互的 Web Component，默认展示渲染好的 SVG，点击可切换到源码查看&lt;br /&gt;3. 支持三种内容输入方式：直接粘贴 Markdown、输入 CORS 兼容的远程 Markdown 文件 URL、或者加载 GitHub Gist 中的第一个文件&lt;br /&gt;4. 用 URL Fragment（#）记录当前加载的文件地址，刷新页面或分享链接时能自动恢复状态，不用依赖后端&lt;br /&gt;5. 安全方面，Simon 后续用 GPT-5.5（Codex xhigh 模式）专门审计并修复了 XSS 漏洞，体现了 AI 辅助开发中「生成 + 安全加固」的两步走思路&lt;br /&gt;6. 整个工具属于 Simon 的「HTML Tools」系列——单文件 HTML+JS+CSS、无构建步骤、托管在 tools.simonwillison.net，目前已积累超过 150 个类似小工具&lt;br /&gt;&lt;br /&gt;URL：&lt;a href=&quot;https://simonwillison.net/2026/May/28/markdown-svg-renderer/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;https://simonwillison.net/2026/May/28/markdown-svg-renderer/&quot;&gt;https://simonwillison.net/2026/May/28/markdown-svg-renderer/&lt;/a&gt;&lt;a class=&quot;tgme_widget_message_link_preview&quot; href=&quot;https://simonwillison.net/2026/May/28/markdown-svg-renderer&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;Renders markdown with a live preview from pasted text, a raw URL, or a GitHub Gist loaded through a `?url=` query parameter, and older `#url=` links redirect to that form. …&quot;&gt;
  
  &lt;div class=&quot;link_preview_site_name accent_color&quot;&gt;Simon Willison’s Weblog&lt;/div&gt;
  
  &lt;div class=&quot;link_preview_title&quot;&gt;Tool: markdown-svg-renderer&lt;/div&gt;
  &lt;div class=&quot;link_preview_description&quot;&gt;Renders markdown with a live preview from pasted text, a raw URL, or a GitHub Gist loaded through a `?url=` query parameter, and older `#url=` links redirect to that form. …&lt;/div&gt;
&lt;/a&gt;</content:encoded></item><item><title>《用 Web Components 构建框架无关的设计系统（实践指南）》</title><link>https://channel.meo-ai.com/posts/650</link><guid isPermaLink="true">https://channel.meo-ai.com/posts/650</guid><pubDate>Sat, 30 May 2026 00:08:24 GMT</pubDate><content:encoded>&lt;span class=&quot;post-title-source&quot;&gt;《用 Web Components 构建框架无关的设计系统（实践指南）》&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;标签：&lt;a href=&quot;/search/result?q=%23%E5%89%8D%E7%AB%AF&quot; title=&quot;#前端&quot;&gt;#前端&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23WebComponents&quot; title=&quot;#WebComponents&quot;&gt;#WebComponents&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E8%AE%BE%E8%AE%A1%E7%B3%BB%E7%BB%9F&quot; title=&quot;#设计系统&quot;&gt;#设计系统&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23Elena&quot; title=&quot;#Elena&quot;&gt;#Elena&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23VitePress&quot; title=&quot;#VitePress&quot;&gt;#VitePress&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23CSS&quot; title=&quot;#CSS&quot;&gt;#CSS&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E6%97%A0%E9%9A%9C%E7%A2%8D&quot; title=&quot;#无障碍&quot;&gt;#无障碍&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;总结：&lt;br /&gt;本文是一份超详细的实战教程，手把手教你用 Web Components（通过 Elena 库）和 VitePress 搭建一个框架无关、可发布的设计系统。核心思路是&quot;最低可行层级&quot;——用 web 标准直接写原子组件，避免框架锁定；组件保持&quot;最笨&quot;状态，把复杂业务逻辑留给应用层。文章涵盖 monorepo 结构搭建、Elena 组件脚手架、条件渲染、&lt;a href=&quot;https://t.me/scope&quot; target=&quot;_blank&quot; title=&quot;@scope&quot;&gt;@scope&lt;/a&gt; 样式隔离、CSS 自定义属性主题化，以及通过 JSDoc + Custom Elements Manifest 自动生成 Props 表格的文档工作流。最终产出的是一个可独立发布的组件包 + 可部署的静态文档站。&lt;br /&gt;&lt;br /&gt;文章要点：&lt;br /&gt;1. 设计系统从第一天就绑定特定框架（如 React）是&quot;令人费解的&quot;——web 标准组件才是可移植、可组合、经得起时间考验的选择&lt;br /&gt;2. Elena 是&quot;刚好够用的抽象&quot;：处理跨框架的 prop/attribute 同步、事件委托等脏活，但不掩盖 web 标准本质&lt;br /&gt;3. 组件应保持&quot;最笨&quot;——被告知显式状态和内容的声明式组件，比内置复杂状态管理的&quot;聪明&quot;组件更健康&lt;br /&gt;4. 设计决策应该在代码中而非 Figma 中完成：现代色彩空间、相对单位、对数排版比例等，设计工具只能模拟浏览器的很小一部分能力&lt;br /&gt;5. 用 &lt;a href=&quot;https://t.me/scope&quot; target=&quot;_blank&quot; title=&quot;@scope&quot;&gt;@scope&lt;/a&gt; 实现样式隔离 + 组件级 CSS 自定义属性作为&quot;最终层 token&quot;，既保证封装又有主题化回退&lt;br /&gt;6. JSDoc 注释即文档：Elena 自动生成 custom-elements.json，VitePress 通过 data loader 直接渲染 PropsTable 和 ComponentHeader&lt;br /&gt;7. 文档即测试场：在 VitePress 中实时预览组件，确保跨框架可移植性；开发时 concurrent 运行 watch + docs:dev 实现热更新&lt;br /&gt;8. 条件渲染示例：同一个组件通过 href prop 自动切换 button/a 标签，CTA 链接按钮的常见需求也能语义化实现&lt;br /&gt;&lt;br /&gt;URL：&lt;a href=&quot;https://piccalil.li/blog/framework-agnostic-design-systems-part-1/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;https://piccalil.li/blog/framework-agnostic-design-systems-part-1/&quot;&gt;https://piccalil.li/blog/framework-agnostic-design-systems-part-1/&lt;/a&gt;&lt;a class=&quot;tgme_widget_message_link_preview&quot; href=&quot;https://piccalil.li/blog/framework-agnostic-design-systems-part-1&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;Baking framework lock-in into your design system from day one is a recipe for obsolescence. Component documentation is often tedious and out-of-sync with development. Let’s build a documentation-first, framework-agnostic component library using web standards…&quot;&gt;
  
  &lt;div class=&quot;link_preview_site_name accent_color&quot;&gt;Piccalilli&lt;/div&gt;
  &lt;img class=&quot;link_preview_image&quot; alt=&quot;Framework-agnostic design systems: a practical approach to web components&quot; src=&quot;/static/https://cdn4.telesco.pe/file/c5MKnRW_4RxCmUAd723zvjHh4L-nLO0G5lNM1Rh-VVrBb9er230bEw9ZYF4VsuuvxN0BVi0YyOXkUFWq_AH9w49QAI6VMwvxXkDpdbB0gIDD7JCyX5AuJ-Ny1v7brQ_shLRPNX7gf8Ay5l_SATf0p3zFlSNh8IGQdLmviOU5QsWPjJRhu8kA0x5HjeMOkTFPFRTGasUhlk6IDbOVvfbHOqbHmEPWU6n08YbW6SS-PHyBD2nmeqUrbZ2UZL9gZQztNv7Dn7GUuYzet9bvQl3-ds-AwqZZkw1-Bv37QOg9VeUCezZYVhY90R8b3s7XeNV8n08Fs1UfIk9tOVbATrIxUQ.jpg&quot; width=&quot;1200&quot; height=&quot;630&quot; loading=&quot;eager&quot; /&gt;
  &lt;div class=&quot;link_preview_title&quot;&gt;Framework-agnostic design systems: a practical approach to web components&lt;/div&gt;
  &lt;div class=&quot;link_preview_description&quot;&gt;Baking framework lock-in into your design system from day one is a recipe for obsolescence. Component documentation is often tedious and out-of-sync with development. Let’s build a documentation-first, framework-agnostic component library using web standards…&lt;/div&gt;
&lt;/a&gt;</content:encoded></item></channel></rss>