<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Elena | 锤子前端</title><description>Now vibe coding, so learning hammer FE ?</description><link>https://channel.meo-ai.com</link><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（通过 &lt;mark class=&quot;highlight&quot;&gt;Elena&lt;/mark&gt; 库）和 VitePress 搭建一个框架无关、可发布的设计系统。核心思路是&quot;最低可行层级&quot;——用 web 标准直接写原子组件，避免框架锁定；组件保持&quot;最笨&quot;状态，把复杂业务逻辑留给应用层。文章涵盖 monorepo 结构搭建、&lt;mark class=&quot;highlight&quot;&gt;Elena&lt;/mark&gt; 组件脚手架、条件渲染、&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. &lt;mark class=&quot;highlight&quot;&gt;Elena&lt;/mark&gt; 是&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 注释即文档：&lt;mark class=&quot;highlight&quot;&gt;Elena&lt;/mark&gt; 自动生成 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>