Bläddra i källkod

docs: update d2c/dsm usage

(cherry picked from commit 95e0db908d446cf21906a59dc35cfd50b7a1086b)
pointhalo 2 år sedan
förälder
incheckning
43af79d6ea
3 ändrade filer med 152 tillägg och 79 borttagningar
  1. 50 26
      README-zh_CN.md
  2. 79 40
      README.md
  3. 23 13
      content/start/faq/index.md

+ 50 - 26
README-zh_CN.md

@@ -9,15 +9,16 @@
     
 <div align="center">
 
-[![NPM][npm-badge]][npm-url] [![FIGMA][figma-badge]][figma-url] [![LICENSE][license-badge]][license-url] 
+[![LICENSE][license-badge]][license-url] [![NPM][npm-badge]][npm-url] [![FIGMA][figma-badge]][figma-url] ![Design Token][Design Token] 
 [![BUILD-JS][build-js-badge]][build-js-url] [![BUILD-CSS][build-css-badge]][build-css-url] [![CODECOV][codecov-badge]][codecov-url] [![Chromatic][chromatic-badge]][chromatic-url] [![Cypress][cypress-badge]][cypress-url]
+[![Twitter Follow](https://img.shields.io/twitter/follow/SemiDesignUI?style=social)](https://twitter.com/SemiDesignUI)
 
 
 [npm-badge]: https://img.shields.io/npm/v/@douyinfe/semi-ui.svg
 [npm-url]: https://www.npmjs.com/package/@douyinfe/semi-ui
 [figma-badge]: https://img.shields.io/badge/Figma-UIKit-%2318a0fb
 [figma-url]: https://www.figma.com/@semi
-
+[Design Token]: https://img.shields.io/badge/Design%20Token-2739%2B-brightgreen
 [license-badge]: https://img.shields.io/npm/l/@douyinfe/semi-ui
 [license-url]: https://github.com/DouyinFE/semi-design/blob/main/LICENSE
 [codecov-badge]: https://img.shields.io/codecov/c/gh/DouyinFE/semi-design
@@ -45,11 +46,11 @@
 # 🎉 特性
 
 - 💪 60+高质量组件
+- 💅 Code2Design,根据不同主题自动生成 Figma UI Kit,保持代码与设计同源
+- 🚀 强大的 D2C (Design2Code)支持,Figma 设计稿一键转出真实代码,快速构建应用
 - 💕 完善的无障碍支持,为所有组件提供遵循 W3C 标准的键盘交互、焦点管理和语义化
 - 🎨 设计系统管理工具 Semi DSM,多达2000+ Design Token,快速定制你的专属设计系统
-- 🌍 国际化支持 17 种语言,提供完备的多语言、多时区、RTL支持
-- 💅 Code2Design,根据不同主题自动生成 Figma UI Kit,保持代码与设计同源
-- 🚀 强大的 Design2Code支持,设计稿一键转代码,快速构建应用
+- 🌍 国际化支持 20+ 语言,提供完备的多语言、多时区、RTL支持
 - ⚙️ 稳定的质量保障,覆盖单元测试、E2E测试、视觉回归测试等多种测试手段
 - 🥳 支持 SSR
 - 👏 使用 TypeScript, 良好的类型定义,基于 Foundation / Adapter 架构,源码易于阅读 / 贡献
@@ -57,35 +58,56 @@
 # 🔥 安装
 
 ```sh
-# 使用 npm
 npm install @douyinfe/semi-ui
-
-# 使用 yarn
-yarn add @douyinfe/semi-ui
-
 ```
 
-# 👍 使用
+# 👍 组件使用
 
 这是一个快速开始的例子:
 
 ```jsx
 import React from 'react';
-import ReactDOM from 'react-dom';
-import { Button, Switch } from '@douyinfe/semi-ui';
+import { createRoot } from 'react-dom/client';
+import { Button, Form } from '@douyinfe/semi-ui';
 
 const App = () => (
-    <>
-        <Button type='primary'>primary button</Button>
-        <Switch size='large' />
-    </>
+    <Form>
+        <Form.Input field='name' initValue='semi design'></Form.Input>
+        <Button htmlType='submit'>submit</Button>
+    </Form>
 );
 
-ReactDOM.render(<App />, document.querySelector('#app'));
+const root = createRoot(document.querySelector('#app'));
+root.render(<App />);
 ```
 
 [Semi UI 官网](https://semi.design) 拥有上千个支持实时调试的例子,欢迎体验使用。
 
+# ⚡️ D2C 设计稿转代码
+
+安装插件 [Semi Figma Plugin](https://www.figma.com/community/plugin/1166339852662786534/Semi-Design-%E8%AE%BE%E8%AE%A1%E8%BD%AC%E4%BB%A3%E7%A0%81). 数秒内将 Figma 转为真实前端代码,支持多种出码格式: JSX + SCSS / Emotion/Tailwind、 JSON Schema DSL
+
+- 支持 Figma Devmode,选中图层后,右侧可直接查看对应的真实代码
+  
+![design2code](https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/github/devmode.gif)
+
+- 或跳转至 Codesandbox 进行二次编辑
+  
+![codesandboxdemo](https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/github/1080p-fps5.gif)
+
+
+# 🎨 DSM 设计系统管理
+
+基于 Semi UI 定制你的专属设计系统, 提供高达 2700+ Token 允许你定义每一处细节. 并时刻在 Figma 与主题商店间保持同步。
+
+![dsm-intro](https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/github/dsm-intro.png)
+
+
+# 📰 关注我们的动态
+* [Follow on Twitter](https://twitter.com/SemiDesignUI)
+* [Follow on Medium](https://medium.com/@semi-design)
+* [Follow on Dev.to](https://dev.to/semidesign)
+
 # 📌 文档
 * [Semi DSM](https://semi.design/dsm)
 * [Semi Design2Code](https://semi.design/code)
@@ -110,18 +132,11 @@ Semi UI 支持所有主流浏览器。
 |--|--|--|--|--|
 | latest 2 versions | latest 2 versions | latest 2 versions | Edge | latest 2 versions |
 
-# 👐 贡献指南
-
-阅读贡献指南了解我们的开发流程,包括开发规范、测试规范和构建规范等。
-
-[CONTRIBUTING](CONTRIBUTING.md)
-
-
 # 👨‍👨‍👧‍👦 交流群
 
 有任何问题可以进群交流,我们会及时给予解答和反馈。
 
-加入[用户群](https://bytedance.feishu.cn/docs/doccnw93Dujm3UCkHRDTMTm1qwe#).
+加入飞书[用户群](https://bytedance.feishu.cn/docs/doccnw93Dujm3UCkHRDTMTm1qwe#).
 
 # 💖 Thanks
 
@@ -133,6 +148,15 @@ Semi UI 支持所有主流浏览器。
 
 感谢 [Cypress](https://www.cypress.io/) 提供 E2E 测试。
 
+## 👐 参与共建
+Semi Design 欢迎社区开发者参与共建,衷心感谢每一位协作者的付出
+
+<a href="https://github.com/DouyinFE/semi-design/graphs/contributors">
+  <img src="https://contrib.rocks/image?repo=DouyinFE/semi-design" />
+</a>
+
+阅读贡献指南了解我们的开发流程,包括开发规范、测试规范和构建规范等: [CONTRIBUTING](CONTRIBUTING.md)
+
 # 🎈 协议
 
 Semi UI 使用 [MIT 协议](LICENSE)

+ 79 - 40
README.md

@@ -9,12 +9,16 @@
     
 <div align="center">
 
-[![NPM][npm-badge]][npm-url] [![CONTRIBUTORS][contributors-badge]][contributors-url] [![FIGMA][figma-badge]][figma-url] [![LICENSE][license-badge]][license-url]
+[![Twitter Follow](https://img.shields.io/twitter/follow/SemiDesignUI?style=social)](https://twitter.com/SemiDesignUI)
+
+[![LICENSE][license-badge]][license-url] [![NPM][npm-badge]][npm-url] [![CONTRIBUTORS][contributors-badge]][contributors-url]  ![Design Token][Design Token] [![FIGMA][figma-badge]][figma-url] 
 [![BUILD-JS][build-js-badge]][build-js-url] [![BUILD-CSS][build-css-badge]][build-css-url] [![CODECOV][codecov-badge]][codecov-url] [![Chromatic][chromatic-badge]][chromatic-url] [![Cypress][cypress-badge]][cypress-url]
 
+
 [npm-badge]: https://img.shields.io/npm/v/@douyinfe/semi-ui.svg
 [contributors-badge]: https://img.shields.io/github/contributors/DouyinFE/semi-design
 [contributors-url]: https://github.com/DouyinFE/semi-design/graphs/contributors
+[Design Token]: https://img.shields.io/badge/Design%20Token-2739%2B-brightgreen
 [npm-url]: https://www.npmjs.com/package/@douyinfe/semi-ui
 [figma-badge]: https://img.shields.io/badge/Figma-UIKit-%2318a0fb
 [figma-url]: https://www.figma.com/@semi
@@ -34,6 +38,7 @@
 [build-css-badge]: https://img.badgesize.io/https:/unpkg.com/@douyinfe/semi-ui/dist/css/semi.min.css?label=semi.min.css&compression=gzip
 [build-css-url]: https://unpkg.com/browse/@douyinfe/semi-ui/dist/css/semi.min.css
 
+
 </div>
 
 <p>
@@ -46,62 +51,92 @@ English | [简体中文](./README-zh_CN.md)
 
 # 🎉 Features
 
-- 💪 Up to 60+ high-quality Components.
+- 💪 Up to 60+ high-quality Components. Stable update since 2019
+- 🚀 Official Design to Code (D2C) support, convert figma draft to real code in a few seconds
+- 💅 Code to Design (C2D), automatically generate Figma UI Kit according to different themes, keep same between design and code
 - 💕 Complete A11y support, follows W3C standards to provide keyboard interaction, focus management and ARIA for all components
-- 💅 Design system management Semi DSM, up to 2000+ Design Tokens, build your own design system quickly.
+- 💅 Design system management Semi DSM, up to 2700+ Design Tokens, make Semi Design to Any Design quickly.
 - 🌍 Internationalization Support for Dozens of Languages, timezone, RTL support
-- 💅 Code2Design, automatically generate Figma UI Kit according to different themes, keep same between design and code
-- 🚀 Powerful Design2Code support, convert figma draft to code in a few seconds
-- ⚙️ Strict quality assurance, covering unit testing, E2E testing, visual testing
+- ⚙️ Strict quality assurance, covering unit testing, E2E testing, visual testing.
 - 👏 Written in Typescript, friendly Static Type Support. Based on Foundation/Adapter architecture, easy to read and contribute
-- 🥳 SSR (Server Side Rendering) Compatible.
+- 🥳 SSR (Server Side Rendering) Compatible. 
 
 # 🔥 Install
 
 ```sh
-# with npm
 npm install @douyinfe/semi-ui
-
-# with yarn
-yarn add @douyinfe/semi-ui
-
 ```
 
-# 👍 Usage
+# 👍 Component Usage
 
 Here is a quick example to get you started, it's all you need:
 
 ```jsx
 import React from 'react';
-import ReactDOM from 'react-dom';
-import { Button, Switch } from '@douyinfe/semi-ui';
+import { createRoot } from 'react-dom/client';
+import { Button, Form } from '@douyinfe/semi-ui';
 
 const App = () => (
-    <>
-        <Button type='primary'>primary button</Button>
-        <Switch size='large' />
-    </>
+    <Form>
+        <Form.Input field='name' initValue='semi design'></Form.Input>
+        <Button htmlType='submit'>submit</Button>
+    </Form>
 );
 
-ReactDOM.render(<App />, document.querySelector('#app'));
+const root = createRoot(document.querySelector('#app'));
+
+root.render(<App />);
 ```
 
-And [Semi UI Doc Site](https://semi.design/en-US/) has hundreds of editable examples and live preview, welcome to play with those examples.
+[Semi UI Doc Site](https://semi.design/en-US/) has hundreds of editable examples and live preview, welcome to play with those examples.
+
+# ⚡️ Design to Code Usage
+
+Install [Semi Figma Plugin](https://www.figma.com/community/plugin/1166339852662786534/Semi-Design-%E8%AE%BE%E8%AE%A1%E8%BD%AC%E4%BB%A3%E7%A0%81). Translate Figma to real code in seconds. Support multiple output formats: JSX + SCSS / Emotion/Tailwind, or JSON Schema DSL
+
+- Support figma devmode, selecting a layer, directly get corresponding code on the right
+  
+![design2code](https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/github/devmode.gif)
+
+- Or jump to codesandbox to continue editing
+  
+![codesandboxdemo](https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/github/1080p-fps5.gif)
+
+
+# 🎨 DSM Usage
+
+Define your own design system base on Semi UI with DSM in one click, Provide more than 2700 tokens for you to configure every detail. Sync between Figma and Code at all times.
+
+![dsm-intro](https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/github/dsm-intro.png)
+
+# 📰 News about Semi UI
+* [Follow on Twitter](https://twitter.com/SemiDesignUI)
+* [Follow on Medium](https://medium.com/@semi-design)
+* [Follow on Dev.to](https://dev.to/semidesign)
+
 
 # 📌 Documentation
 * [Semi DSM](https://semi.design/dsm)
-* [Semi Design2Code](https://semi.design/code/en-US)
+* [Design to Code](https://semi.design/code/en-US)
 * [Semi Figma Plugin](https://www.figma.com/community/plugin/1166339852662786534/Semi-Design-%E8%AE%BE%E8%AE%A1%E8%BD%AC%E4%BB%A3%E7%A0%81)
-* [Quick Start](https://semi.design/zh-CN/start/getting-started)
-* [Components Overview](https://semi.design/zh-CN/start/overview)
-* [Customizing Themes](https://semi.design/zh-CN/start/customize-theme)
-* [Design Tokens](https://semi.design/zh-CN/basic/tokens)
-* [Dark Mode](https://semi.design/zh-CN/start/dark-mode)
-* [Semi Icons](https://semi.design/zh-CN/basic/icon)
-* [Global Config](https://semi.design/zh-CN/other/configprovider)
-* [Internationalization](https://semi.design/zh-CN/other/locale)
-* [FAQ](https://semi.design/zh-CN/start/faq)
-* [CHANGELOG](https://semi.design/zh-CN/start/changelog)
+* [Quick Start](https://semi.design/en-US/start/getting-started)
+* [Components Overview](https://semi.design/en-US/start/overview)
+* [Customizing Themes](https://semi.design/en-US/start/customize-theme)
+* [Design Tokens](https://semi.design/en-US/basic/tokens)
+* [Dark Mode](https://semi.design/en-US/start/dark-mode)
+* [Semi Icons](https://semi.design/en-US/basic/icon)
+* [Global Config](https://semi.design/en-US/other/configprovider)
+* [Internationalization](https://semi.design/en-US/other/locale)
+* [FAQ](https://semi.design/en-US/start/faq)
+* [CHANGELOG](https://semi.design/en-US/start/changelog)
+
+# 📝 Blogs
+- [The Evolution of Semi D2C Design to Code](https://juejin.cn/post/7267418854124699702)
+- [How to design component library architecture to adapt to different mvvm frameworks](https://bytedance.feishu.cn/wiki/wikcnOVYexosCS1Rmvb5qCsWT1f)
+- [How we test semi ui](https://medium.com/front-end-weekly/how-we-test-semi-design-component-libraries-64b854f63b65)
+- [In-depth explanation of Semi theme](https://mp.weixin.qq.com/s/noHoWRuA25PgqFNcurhIUA)
+- [Accessibility in Semi Design](https://mp.weixin.qq.com/s/O3js-SZDNPEOjGxh-aAkbw)
+
 
 # 👌 Platform Support
 
@@ -111,16 +146,9 @@ Semi UI supports all major modern browsers.
 |--|--|--|--|--|
 | latest 2 versions | latest 2 versions | latest 2 versions | Edge | latest 2 versions |
 
-# 👐 Contributing
-
-Read the contributing guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to Semi UI.
-
-See [CONTRIBUTING](CONTRIBUTING-en-US.md) documentation.
-
-
 # 👨‍👨‍👧‍👦 User Group
 
-Join [User Group](https://bytedance.feishu.cn/docs/doccnw93Dujm3UCkHRDTMTm1qwe#).
+Join [User Group](https://bytedance.feishu.cn/docs/doccnw93Dujm3UCkHRDTMTm1qwe#) on Feishu / Lark
 
 # 💖 Thanks
 
@@ -132,6 +160,17 @@ Thanks to [Chromatic](https://www.chromatic.com/) for providing the visual testi
 
 Thanks to [Cypress](https://www.cypress.io/) for providing E2E testing.
 
+## 👐 Contributing
+Thanks to all the people who already contributed!
+
+<a href="https://github.com/DouyinFE/semi-design/graphs/contributors">
+  <img src="https://contrib.rocks/image?repo=DouyinFE/semi-design" />
+</a>
+
+Read the contributing guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to Semi UI.
+
+See [CONTRIBUTING](CONTRIBUTING-en-US.md) documentation.
+
 # 🎈 License
 
 Semi UI is [MIT Licensed](LICENSE)

+ 23 - 13
content/start/faq/index.md

@@ -3,11 +3,27 @@ category: 开始
 title: FAQ 常见问题
 icon: doc-faq
 localeCode: zh-CN
-order: 10
+order: 8
 ---
 
 #### Semi 提供了 Figma UI Kit,考虑提供 Sketch 或基于其他设计工具的版本吗?
-- 目前没有这方面的计划,具体原因请参考 [Issue 74](https://github.com/DouyinFE/semi-design/issues/74)
+暂无计划,具体原因请参考 [Issue 74](https://github.com/DouyinFE/semi-design/issues/74)
+
+#### Semi 目前提供了基于 React 版本的 ui library,是否有官方提供其他技术栈 lib 的计划?
+暂无计划。具体原因:[Issue 311](https://github.com/DouyinFE/semi-design/issues/311),更多讨论 [Issue 56](https://github.com/DouyinFE/semi-design/issues/56)
+
+#### Semi 后续会提供移动端组件吗 ? 
+暂无计划,具体原因参考 [discussions 287](https://github.com/DouyinFE/semi-design/discussions/287)
+
+#### Semi 的默认的主题风格跟我们系统的定位不符,可以配置另外的主题吗?
+
+- 具体请参考 [定制主题](/zh-CN/start/customize-theme) 。Semi 提供**多达 2700+ Design Token 允许用户进行深度定制**,无论你是研发还是设计师,在 [Semi DSM](/dsm) 里可以非常方便地进行样式层配置,并在代码、设计稿始终保持双向同步。基于 Semi 你可以**低成本定制属于你自己的 Design System** 将 `Semi Design` 定制为 `Any Design`
+- 并且在使用时,你也只需要在 webpack.config.js 里指定使用的主题包名即可完成接入(需接入 Semi 插件)
+  
+#### 什么情况下推荐使用 Design Token 定制样式,什么情况下推荐通过 css 覆盖方式定制样式?
+
+- Design Token 主要适用于需要做品牌化、样式风格定制的场景,需要通过 [Semi DSM](/dsm) 进行配置,发布产物为 npm 主题包。Design Token的作用范围为全局生效。例如调整了 Button、Table 的组件级Token,那么对于 App 内所有 Semi Button、Semi Table 都会生效,无法仅针对某个特定子模块调整
+- 如果你只需要将某个特定模块下的某个组件的样式做调整,不推荐使用 Design Token,推荐直接使用 CSS 选择器覆盖样式
 
 #### Semi 2.x 与 Semi 1.x 有什么不同?
 
@@ -24,15 +40,9 @@ order: 10
 -   1.x 各版本之间,API 也会保持**向前兼容**。由 1.x 升级到 2.x 时,会包含 breaking change,具体升级注意事项请查阅文档
 -   0.x 版本目前已停止更新,当且仅当必须进行 bugfix 时才会进行 hotfix 更新。由 0.x 升级至 1.x 时,会包含 breaking change,具体升级注意事项请查阅文档
 
-#### Semi 的默认的主题风格跟我们系统的定位不符,可以配置另外的主题吗?
-
-- 具体请参考 [定制主题](/zh-CN/start/customize-theme) 。Semi 提供**多达 2300+ Design Token 允许用户进行深度定制**,无论你是研发还是设计师,在[Semi DSM](/dsm) 里可以非常方便地进行样式层配置,并在代码、设计稿始终保持双向同步。基于 Semi 你可以**低成本定制属于你自己的 Design System** 将 `Semi Design` 定制为 `Any Design`
-- 并且在使用时,你也只需要在 webpack.config.js 里指定使用的主题包名即可完成接入(需接入 Semi 插件)。
-
 #### Semi 是否支持 Tree Shaking
 
--   Semi 执行发包时,发布的其实是 esModule 源码,因此天然支持 tree shaking,不需要再进行额外的配置。
--   组件的 Scss 也是由组件的 index.(j|t)sx 负责 import 的,因此样式也会 shaking。简单来说,只有你使用的组件会被打包
+Semi 执行发包时,发布的其实是 esModule 源码,因此天然支持 tree shaking,不需要再进行额外的配置; 组件的 Scss 也是由组件的 index.(j|t)sx 负责 import 的,因此样式也会 shaking。简单来说,只有你使用的组件会被打包。
 
 #### 为什么 defaultValue、defaultXXX 不起作用?
 
@@ -47,19 +57,19 @@ Semi 组件中,所有的 defaultValue、defaultXXX 传参只会在组件被 mo
 
 #### Semi 支持 i18n 吗?
 
-Semi 目前支持 17 种语言,具体使用可以查阅 [Semi·LocaleProvider](/zh-CN/other/locale)
+Semi 目前支持 21 种语言,具体使用可以查阅 [Semi·LocaleProvider](/zh-CN/other/locale)
 
 #### Semi 的样式是基于 Scss 还是 Less ?为什么不用 CSS Module?
 
 我们的样式基于 Scss,与此我们还使用了 CSS Variable 作为色盘变量。色盘变量和通用变量挂载在 body 下。不使用 CSS Module 是因为我们希望有固定的 className,为业务方保留修改/覆盖 Semi 样式的能力(虽然不提倡,但有些业务场景下确实需要)
 
-#### 为什么 Tooltip、Typography 不默认配置 word-break 样式?
+#### 为什么 Tooltip content 配置很长很长的内容时,某些情况下内容会超出显示区域?
 
-不同语言内容(纯英文、中文、中英文混合)对 word-break 的需求不太一致,所以组件层没有做这个预设。可以根据需求,使用 CSS 进行设置
+在 v2.36.0 版本以前,考虑到不同语言内容(纯英文、中文、中英文混合、其他语种混合)对换行的需求不太一致,所以组件层没有做这个预设。在接收到较多使用反馈后,自 v2.36.0 版本,Tooltip 内部通过设置 <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap" target="_blank" rel="noopener noreferrer">word-wrap</a> 为 break-word 处理文本换行。对于任意版本,如果默认设置不符合预期,使用方都可以通过 style/className API 设置换行相关 CSS 属性进行调整
 
 #### 有新组件需求、或者现有组件 Feature 不能满足我的业务需求,该找谁?
 
-右上角问题反馈,提交 Issue,描述你的需求以及业务场景,Label 选择 `Feature Request` / `New Component Request`
+在Github 提交 Issue,描述你的需求以及业务场景,Label 选择 `Feature Request` / `New Component Request`
 
 #### 对组件的使用有疑惑?不知道有没有能满足你业务需求场景的组件?