@modern-js/module-tools-docs 2.0.0-beta.4 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/.eslintrc.js +13 -0
  2. package/docs/en/api/config/_category_.json +4 -0
  3. package/docs/en/api/{build-config.md → config/build-config.md} +198 -105
  4. package/docs/en/api/{build-preset.md → config/build-preset.md} +65 -46
  5. package/docs/{zh/api → en/api/config}/design-system.md +130 -127
  6. package/docs/en/api/config/plugins.md +18 -0
  7. package/docs/en/api/{test.md → config/testing.md} +21 -12
  8. package/docs/en/api/index.md +3 -1
  9. package/docs/en/api/plugin-api/_category_.json +4 -0
  10. package/docs/en/api/plugin-api/plugin-hooks.md +501 -0
  11. package/docs/en/guide/advance/_category_.json +4 -0
  12. package/docs/en/guide/advance/asset.mdx +47 -30
  13. package/docs/en/guide/advance/build-umd.mdx +88 -80
  14. package/docs/en/guide/advance/copy.md +31 -28
  15. package/docs/en/guide/advance/external-dependency.mdx +27 -23
  16. package/docs/en/guide/advance/in-depth-about-build.md +56 -50
  17. package/docs/en/guide/advance/in-depth-about-dev-command.md +7 -4
  18. package/docs/en/guide/advance/theme-config.mdx +80 -0
  19. package/docs/en/guide/basic/_category_.json +4 -0
  20. package/docs/en/guide/basic/before-getting-started.md +28 -23
  21. package/docs/en/guide/basic/command-preview.md +18 -14
  22. package/docs/en/guide/basic/modify-output-product.md +27 -20
  23. package/docs/en/guide/basic/publish-your-project.md +21 -19
  24. package/docs/en/guide/basic/test-your-project.mdx +19 -16
  25. package/docs/en/guide/basic/use-micro-generator.md +10 -7
  26. package/docs/en/guide/basic/using-storybook.mdx +27 -26
  27. package/docs/en/guide/best-practices/_category_.json +4 -0
  28. package/docs/en/guide/best-practices/components.mdx +783 -0
  29. package/docs/en/guide/intro/_category_.json +4 -0
  30. package/docs/en/guide/intro/getting-started.md +9 -4
  31. package/docs/en/guide/intro/welcome.md +4 -0
  32. package/docs/en/guide/intro/why-module-engineering-solution.md +5 -1
  33. package/docs/en/index.md +3 -5
  34. package/docs/en/plugins/guide/_category_.json +4 -0
  35. package/docs/en/plugins/guide/getting-started.mdx +84 -0
  36. package/docs/en/plugins/guide/plugin-object.mdx +85 -0
  37. package/docs/en/plugins/guide/setup-function.mdx +117 -0
  38. package/docs/en/plugins/official-list/_category_.json +4 -0
  39. package/docs/en/plugins/official-list/overview.md +6 -0
  40. package/docs/zh/api/config/_category_.json +4 -0
  41. package/docs/zh/api/config/build-config.md +658 -0
  42. package/docs/zh/api/{build-preset.md → config/build-preset.md} +49 -36
  43. package/docs/zh/api/config/design-system.md +1166 -0
  44. package/docs/zh/api/config/plugins.md +18 -0
  45. package/docs/zh/api/{testing.md → config/testing.md} +18 -13
  46. package/docs/zh/api/index.md +4 -1
  47. package/docs/zh/api/plugin-api/_category_.json +4 -0
  48. package/docs/zh/api/plugin-api/plugin-hooks.md +500 -0
  49. package/docs/zh/guide/advance/_category_.json +4 -0
  50. package/docs/zh/guide/advance/asset.mdx +47 -30
  51. package/docs/zh/guide/advance/build-umd.mdx +88 -71
  52. package/docs/zh/guide/advance/copy.md +31 -28
  53. package/docs/zh/guide/advance/external-dependency.mdx +27 -23
  54. package/docs/zh/guide/advance/in-depth-about-build.md +55 -50
  55. package/docs/zh/guide/advance/in-depth-about-dev-command.md +7 -4
  56. package/docs/zh/guide/advance/theme-config.mdx +78 -0
  57. package/docs/zh/guide/basic/_category_.json +4 -0
  58. package/docs/zh/guide/basic/before-getting-started.md +27 -22
  59. package/docs/zh/guide/basic/command-preview.md +17 -13
  60. package/docs/zh/guide/basic/modify-output-product.md +28 -21
  61. package/docs/zh/guide/basic/publish-your-project.md +22 -17
  62. package/docs/zh/guide/basic/test-your-project.mdx +20 -16
  63. package/docs/zh/guide/basic/use-micro-generator.md +10 -7
  64. package/docs/zh/guide/basic/using-storybook.mdx +27 -24
  65. package/docs/zh/guide/best-practices/_category_.json +4 -0
  66. package/docs/zh/guide/best-practices/components.mdx +793 -0
  67. package/docs/zh/guide/intro/_category_.json +4 -0
  68. package/docs/zh/guide/intro/getting-started.md +10 -4
  69. package/docs/zh/guide/intro/welcome.md +4 -0
  70. package/docs/zh/guide/intro/why-module-engineering-solution.md +5 -1
  71. package/docs/zh/index.md +3 -2
  72. package/docs/zh/plugins/guide/_category_.json +4 -0
  73. package/docs/zh/plugins/guide/getting-started.mdx +84 -0
  74. package/docs/zh/plugins/guide/plugin-object.mdx +85 -0
  75. package/docs/zh/plugins/guide/setup-function.mdx +117 -0
  76. package/docs/zh/plugins/official-list/_category_.json +4 -0
  77. package/docs/zh/plugins/official-list/overview.md +5 -0
  78. package/modern.config.ts +118 -0
  79. package/package.json +8 -6
  80. package/{docs/.island/styles → theme}/index.css +0 -1
  81. package/theme/index.ts +4 -0
  82. package/tsconfig.json +7 -0
  83. package/docs/.island/config.ts +0 -245
  84. package/docs/.island/dist/404.html +0 -41
  85. package/docs/.island/dist/assets/before-getting-started.1b82b538.js +0 -87
  86. package/docs/.island/dist/assets/before-getting-started.582a31cc.js +0 -87
  87. package/docs/.island/dist/assets/build-config.72eb0918.js +0 -804
  88. package/docs/.island/dist/assets/build-config.d8bb1658.js +0 -809
  89. package/docs/.island/dist/assets/build-preset.96805d7d.js +0 -256
  90. package/docs/.island/dist/assets/build-preset.c20dcd40.js +0 -256
  91. package/docs/.island/dist/assets/build-your-ui.7f349247.js +0 -2
  92. package/docs/.island/dist/assets/build-your-ui.a8361604.js +0 -2
  93. package/docs/.island/dist/assets/command-preview.2d45fc82.js +0 -264
  94. package/docs/.island/dist/assets/command-preview.dc51b953.js +0 -264
  95. package/docs/.island/dist/assets/components.esm.03560353.js +0 -9
  96. package/docs/.island/dist/assets/design-system.86694ff5.js +0 -1254
  97. package/docs/.island/dist/assets/design-system.c4745cce.js +0 -639
  98. package/docs/.island/dist/assets/dev.1d326a37.js +0 -37
  99. package/docs/.island/dist/assets/dev.1fd06000.js +0 -37
  100. package/docs/.island/dist/assets/down.f35427d3.svg +0 -1
  101. package/docs/.island/dist/assets/extension.12299fd6.js +0 -2
  102. package/docs/.island/dist/assets/extension.96dc63a4.js +0 -2
  103. package/docs/.island/dist/assets/getting-started.40e9218d.js +0 -117
  104. package/docs/.island/dist/assets/getting-started.b1ed3f10.js +0 -114
  105. package/docs/.island/dist/assets/github.3bf8ccee.svg +0 -1
  106. package/docs/.island/dist/assets/index.2b2347ea.js +0 -33
  107. package/docs/.island/dist/assets/index.6cef6f5f.js +0 -4
  108. package/docs/.island/dist/assets/index.cb118238.js +0 -36
  109. package/docs/.island/dist/assets/index.ccb6ce27.js +0 -4
  110. package/docs/.island/dist/assets/island_inject.11a12ecc.js +0 -1
  111. package/docs/.island/dist/assets/island_inject.b13deaee.js +0 -1
  112. package/docs/.island/dist/assets/loading.8c9bb911.svg +0 -1
  113. package/docs/.island/dist/assets/modify-output-product.7f6bff35.js +0 -100
  114. package/docs/.island/dist/assets/modify-output-product.b91eff1f.js +0 -100
  115. package/docs/.island/dist/assets/moon.6b705924.svg +0 -3
  116. package/docs/.island/dist/assets/plugin.895932d8.js +0 -42
  117. package/docs/.island/dist/assets/plugin.d2fbc531.js +0 -42
  118. package/docs/.island/dist/assets/publish-your-project.21b8309f.js +0 -164
  119. package/docs/.island/dist/assets/publish-your-project.8d398b17.js +0 -166
  120. package/docs/.island/dist/assets/right.89674cd7.svg +0 -1
  121. package/docs/.island/dist/assets/search.0aea6901.svg +0 -1
  122. package/docs/.island/dist/assets/search.1c85d17c.js +0 -3
  123. package/docs/.island/dist/assets/search.484eca11.js +0 -222
  124. package/docs/.island/dist/assets/search.54fca8d0.js +0 -3
  125. package/docs/.island/dist/assets/style.09015a4b.css +0 -1
  126. package/docs/.island/dist/assets/style.2e5f7bc2.css +0 -1970
  127. package/docs/.island/dist/assets/sun.841dac10.svg +0 -11
  128. package/docs/.island/dist/assets/test-your-project.18bd4582.js +0 -190
  129. package/docs/.island/dist/assets/test-your-project.f53bebf7.js +0 -190
  130. package/docs/.island/dist/assets/test.0da1f99f.js +0 -67
  131. package/docs/.island/dist/assets/test.0e81f002.js +0 -66
  132. package/docs/.island/dist/assets/translator.b1077c44.svg +0 -1
  133. package/docs/.island/dist/assets/use-micro-generator.7d9e4016.js +0 -60
  134. package/docs/.island/dist/assets/use-micro-generator.db5520c1.js +0 -60
  135. package/docs/.island/dist/assets/using-storybook.57ea6b77.js +0 -260
  136. package/docs/.island/dist/assets/using-storybook.a2212f2e.js +0 -260
  137. package/docs/.island/dist/assets/welcome.0449a9c8.js +0 -13
  138. package/docs/.island/dist/assets/welcome.a8448931.js +0 -13
  139. package/docs/.island/dist/assets/why-module-engineering-solution.6ae8c0e3.js +0 -26
  140. package/docs/.island/dist/assets/why-module-engineering-solution.c9a45cbd.js +0 -26
  141. package/docs/.island/dist/chunk-COLCRJ2V.js +0 -1
  142. package/docs/.island/dist/chunk-K5FMOYDC.js +0 -10
  143. package/docs/.island/dist/chunk-WE42KMYS.js +0 -26
  144. package/docs/.island/dist/client-entry.js +0 -3
  145. package/docs/.island/dist/en/api/build-config.html +0 -344
  146. package/docs/.island/dist/en/api/build-preset.html +0 -82
  147. package/docs/.island/dist/en/api/design-system.html +0 -155
  148. package/docs/.island/dist/en/api/dev.html +0 -45
  149. package/docs/.island/dist/en/api/index.html +0 -41
  150. package/docs/.island/dist/en/api/plugin.html +0 -48
  151. package/docs/.island/dist/en/api/test.html +0 -58
  152. package/docs/.island/dist/en/guide/before-getting-started.html +0 -127
  153. package/docs/.island/dist/en/guide/build-your-ui.html +0 -41
  154. package/docs/.island/dist/en/guide/command-preview.html +0 -100
  155. package/docs/.island/dist/en/guide/extension.html +0 -41
  156. package/docs/.island/dist/en/guide/getting-started.html +0 -76
  157. package/docs/.island/dist/en/guide/modify-output-product.html +0 -140
  158. package/docs/.island/dist/en/guide/publish-your-project.html +0 -91
  159. package/docs/.island/dist/en/guide/test-your-project.html +0 -72
  160. package/docs/.island/dist/en/guide/use-micro-generator.html +0 -65
  161. package/docs/.island/dist/en/guide/using-storybook.html +0 -113
  162. package/docs/.island/dist/en/guide/welcome.html +0 -53
  163. package/docs/.island/dist/en/guide/why-module-engineering-solution.html +0 -49
  164. package/docs/.island/dist/en/index.html +0 -42
  165. package/docs/.island/dist/react-dom.js +0 -1
  166. package/docs/.island/dist/react-dom_client.js +0 -1
  167. package/docs/.island/dist/react.js +0 -1
  168. package/docs/.island/dist/react_jsx-runtime.js +0 -10
  169. package/docs/.island/dist/ssr-manifest.json +0 -57
  170. package/docs/.island/dist/test-result.png +0 -0
  171. package/docs/.island/dist/why-module-solution.png +0 -0
  172. package/docs/.island/dist/zh/api/build-config.html +0 -347
  173. package/docs/.island/dist/zh/api/build-preset.html +0 -82
  174. package/docs/.island/dist/zh/api/design-system.html +0 -149
  175. package/docs/.island/dist/zh/api/dev.html +0 -46
  176. package/docs/.island/dist/zh/api/index.html +0 -41
  177. package/docs/.island/dist/zh/api/plugin.html +0 -48
  178. package/docs/.island/dist/zh/api/test.html +0 -59
  179. package/docs/.island/dist/zh/guide/before-getting-started.html +0 -127
  180. package/docs/.island/dist/zh/guide/build-your-ui.html +0 -41
  181. package/docs/.island/dist/zh/guide/command-preview.html +0 -100
  182. package/docs/.island/dist/zh/guide/extension.html +0 -41
  183. package/docs/.island/dist/zh/guide/getting-started.html +0 -79
  184. package/docs/.island/dist/zh/guide/modify-output-product.html +0 -140
  185. package/docs/.island/dist/zh/guide/publish-your-project.html +0 -92
  186. package/docs/.island/dist/zh/guide/test-your-project.html +0 -72
  187. package/docs/.island/dist/zh/guide/use-micro-generator.html +0 -65
  188. package/docs/.island/dist/zh/guide/using-storybook.html +0 -114
  189. package/docs/.island/dist/zh/guide/welcome.html +0 -53
  190. package/docs/.island/dist/zh/guide/why-module-engineering-solution.html +0 -49
  191. package/docs/.island/dist/zh/index.html +0 -42
  192. package/docs/.island/index.html +0 -39
  193. package/docs/en/api/design-system.md +0 -524
  194. package/docs/en/api/dev.md +0 -32
  195. package/docs/en/api/plugin.md +0 -34
  196. package/docs/zh/api/build-config.md +0 -570
  197. package/docs/zh/api/dev.md +0 -33
  198. package/docs/zh/api/plugins.md +0 -108
@@ -1,17 +1,20 @@
1
+ ---
2
+ sidebar_position: 3
3
+ ---
4
+
1
5
  # DesignSystem
2
- 本章描述了有关designSystem相关的配置
6
+
7
+ This chapter describes the configuration related to designSystem
3
8
 
4
9
  :::tips
5
- 需要先通过 `pnpm run new` 启用 Tailwind CSS 功能。
10
+ The Tailwind CSS feature needs to be enabled first via `pnpm run new`.
6
11
  :::
7
12
 
13
+ - type: `Object`
14
+ - default: `see configuration details below`.
8
15
 
9
- - type: `Object`
10
- - default: `见下方配置详情`。
11
-
12
- <details>
13
- <summary>designSystem 配置详情</summary>
14
-
16
+ <details
17
+ <summary>designSystem configuration details</summary>
15
18
  ```js
16
19
  const designSystem = {
17
20
  screens: {
@@ -631,22 +634,23 @@
631
634
  '700': '700ms',
632
635
  '1000': '1000ms',
633
636
  },
634
- };
635
- ```
636
637
 
638
+ };
639
+
640
+ ````
637
641
  :::tips
638
- 更多关于[TailwindCSS 配置](https://tailwindcss.com/docs/configuration#theme)
642
+ More about [TailwindCSS configuration](https://tailwindcss.com/docs/configuration#theme)
639
643
  :::
640
644
  </details>
641
645
 
642
646
 
643
- `designSystem` 用于定义项目的调色板、排版比例(Typographic Scales 或者 Type Scale)、字体列表、断点、边框圆角值等等。因为 Modern.js 借用了 Tailwind Theme 的设计方式,并且内部也集成了 Tailwind CSS,所以 `designSystem` 使用方式与 Tailwind CSS Theme 相同
647
+ The `designSystem` is used to define the project's color palette, typographic scales (Typographic Scales or Type Scale), font list, breakpoints, border rounding values, etc. Since Modern.js borrows the design approach from Tailwind Theme and integrates with Tailwind CSS internally, `designSystem` is used in the same way as Tailwind CSS Theme
644
648
 
645
- `designSystem` 对象包含 `screens`、`colors` `spacing` 的属性,以及每个可自定义核心插件。
649
+ The `designSystem` object contains the `screens`, `colors` and `spacing` properties, as well as each customizable core plugin.
646
650
 
647
651
  ## Screens
648
652
 
649
- 使用`screens` 可以自定义项目中的响应断点:
653
+ The responsive breakpoints in your project can be customized using `screens`: the
650
654
 
651
655
  ```js
652
656
  const designSystem = {
@@ -657,11 +661,11 @@ const designSystem = {
657
661
  xl: '1280px',
658
662
  },
659
663
  };
660
- ```
664
+ ````
661
665
 
662
- 其中 `screens` 对象里的属性名是屏幕名称(用作 `Tailwind CSS` 生成的自适应实用程序变体的前缀,例如 `md:text-center`),值是该断点应在其开始的 `min-width`。
666
+ where the property name in the `screens` object is the screen name (used as a prefix for the adaptive utility variants generated by `Tailwind CSS`, e.g. `md:text-center`) and the value is the `min-width` at which the breakpoint should start.
663
667
 
664
- 默认断点受常见设备分辨率的启发:
668
+ Default breakpoints are inspired by common device resolutions: the
665
669
 
666
670
  ```js
667
671
  const designSystem = {
@@ -681,7 +685,7 @@ const designSystem = {
681
685
  };
682
686
  ```
683
687
 
684
- 你可以在你的项目中使用任意你喜欢的名称作为断点的属性:
688
+ You can use any name you like as a breakpoint property in your project: the
685
689
 
686
690
  ```js
687
691
  const designSystem = {
@@ -698,32 +702,40 @@ const designSystem = {
698
702
  };
699
703
  ```
700
704
 
701
- 这些屏幕名称反映在 `utilities` 中,因此 `text-center` 现在是这样的:
705
+ These screen names are reflected in `utilities`, so `text-center` now looks like this
702
706
 
703
707
  ```css
704
- .text-center { text-align: center }
708
+ .text-center {
709
+ text-align: center;
710
+ }
705
711
 
706
712
  @media (min-width: 640px) {
707
- .tablet\:text-center { text-align: center }
713
+ .tablet\:text-center {
714
+ text-align: center;
715
+ }
708
716
  }
709
717
 
710
718
  @media (min-width: 1024px) {
711
- .laptop\:text-center { text-align: center }
719
+ .laptop\:text-center {
720
+ text-align: center;
721
+ }
712
722
  }
713
723
 
714
724
  @media (min-width: 1280px) {
715
- .desktop\:text-center { text-align: center }
725
+ .desktop\:text-center {
726
+ text-align: center;
727
+ }
716
728
  }
717
729
  ```
718
730
 
719
- ### Max-width 断点
731
+ ### Max-width breakpoints
720
732
 
721
- 如果要使用 `max-width` 断点而不是 `min-width`,可以将屏幕指定为具有 `max` 属性的对象:
733
+ To use the `max-width` breakpoint instead of `min-width`, you can specify the screen as an object with the `max` attribute.
722
734
 
723
735
  ```js
724
736
  const designSystem = {
725
737
  screens: {
726
- xl: { max: '1279px' },
738
+ xl: { max: '1279px' }
727
739
  // => @media (max-width: 1279px) { ... }
728
740
 
729
741
  lg: { max: '1023px' },
@@ -738,24 +750,24 @@ const designSystem = {
738
750
  };
739
751
  ```
740
752
 
741
- 如有必要,以创建带有 `min-width` `max-width` 定义的断点,例如:
753
+ If necessary, to create breakpoints with `min-width` and `max-width` definitions, e.g.
742
754
 
743
755
  ```js
744
756
  const designSystem = {
745
757
  screens: {
746
- sm: { min: '640px', max: '767px' },
747
- md: { min: '768px', max: '1023px' },
748
- lg: { min: '1024px', max: '1279px' },
749
- xl: { min: '1280px' },
758
+ sm: { min: '640px', max: '767px' }
759
+ md: { min: '768px', max: '1023px' }
760
+ lg: { min: '1024px', max: '1279px' }, lg: { min: '1024px', max: '1279px' },
761
+ xl: { min: '1280px' }
750
762
  },
751
763
  };
752
764
  ```
753
765
 
754
- ### 多个范围的断点
766
+ ### Multiple range breakpoints
755
767
 
756
- 有时,将单个断点定义应用于多个范围会很有用。
768
+ Sometimes it can be useful to apply a single breakpoint definition to multiple scopes.
757
769
 
758
- 例如,假设您有一个 `sidebar`,并且希望断点基于内容区域宽度而不是整个视口。您可以模拟这种情况,当 `sidebar` 可见并缩小内容区域时,断点的样式使用较小的断点样式:
770
+ For example, suppose you have a `sidebar` and want the breakpoint to be based on the width of the content area rather than the entire viewport. You can simulate this situation by using a smaller breakpoint style when the `sidebar` is visible and the content area is narrowed: the
759
771
 
760
772
  ```js
761
773
  const designSystem = {
@@ -765,8 +777,8 @@ const designSystem = {
765
777
  // Sidebar appears at 768px, so revert to `sm:` styles between 768px
766
778
  // and 868px, after which the main content area is wide enough again to
767
779
  // apply the `md:` styles.
768
- { min: '668px', max: '767px' },
769
- { min: '868px' },
780
+ { min: '668px', max: '767px' }
781
+ { min: '868px' }, { min: '868px' },
770
782
  ],
771
783
  lg: '1100px',
772
784
  xl: '1400px',
@@ -774,9 +786,9 @@ const designSystem = {
774
786
  };
775
787
  ```
776
788
 
777
- ### 自定义媒体查询
789
+ ### Custom media queries
778
790
 
779
- 如果需要为断点提供完全自定义的媒体查询,则可以使用带有 `raw` 属性的对象:
791
+ If a fully customizable media query is required for a breakpoint, an object with the `raw` attribute can be used.
780
792
 
781
793
  ```js
782
794
  const designSystem = {
@@ -789,30 +801,31 @@ const designSystem = {
789
801
  };
790
802
  ```
791
803
 
792
- ### Print 样式
804
+ ### Print styles
793
805
 
794
- 如果需要为打印应用不同的样式,则 `raw` 选项可能特别有用。
806
+ The `raw` option may be particularly useful if you need to apply different styles to printing.
795
807
 
796
- 需要做的就是在 `designSystem.extend.screens` 下添加一个 `print`:
808
+ All that needs to be done is to add a `print` under `designSystem.extend.screens`.
797
809
 
798
- ```js
810
+ ``js
799
811
  const designSystem = {
800
- extend: {
801
- screens: {
802
- print: { raw: 'print' },
803
- // => @media print { ... }
804
- },
805
- },
812
+ extend: {
813
+ screens: {
814
+ print: { raw: 'print' },
815
+ // => @media print { ... }
816
+ },
817
+ },
806
818
  };
807
- ```
808
819
 
809
- 然后,可以使用诸如 `print:text-black` 之类的类来指定仅当某人尝试打印页面时才应用的样式:
820
+ ````
821
+
822
+ Then, a class such as ``print:text-black`` can be used to specify a style that is applied only when someone tries to print a page: ``
810
823
 
811
824
  ```html
812
825
  <div class="text-gray-700 print:text-black">
813
- <!-- ... -->
826
+ <! -- ... -->
814
827
  </div>
815
- ```
828
+ ````
816
829
 
817
830
  ### Dark Mode
818
831
 
@@ -833,7 +846,7 @@ const designSystem = {
833
846
 
834
847
  ```html
835
848
  <div class="text-gray-700 dark:text-gray-200">
836
- <!-- ... -->
849
+ <! -- ... -->
837
850
  </div>
838
851
  ```
839
852
 
@@ -860,13 +873,13 @@ const designSystem = {
860
873
  };
861
874
  ```
862
875
 
863
- 默认情况下,这些颜色由 `backgroundColor`,`textColor` `borderColor` 核心插件继承。
876
+ By default, these colors are inherited by the `backgroundColor`, `textColor` and `borderColor` core plugins.
864
877
 
865
- 想了解更多,可以查看:[Customizing Colors](https://tailwindcss.com/docs/customizing-colors)
878
+ To learn more, you can check out: [Customizing Colors](https://tailwindcss.com/docs/customizing-colors).
866
879
 
867
880
  ## Spacing
868
881
 
869
- 使用 `space` 属性,可以自定义项目的全局间距和缩放比例:
882
+ The global spacing and scaling of items can be customized using the `space` attribute: the
870
883
 
871
884
  ```js
872
885
  const designSystem = {
@@ -894,52 +907,53 @@ const designSystem = {
894
907
  };
895
908
  ```
896
909
 
897
- 默认情况下,这些值由 `padding`,`margin`,`negativeMargin`,`width` `height` 核心插件继承。
910
+ By default, these values are inherited by the `padding`, `margin`, `negativeMargin`, `width` and `height` core plugins.
898
911
 
899
- 想要了解更多,看 [Customizing Spacing](https://tailwindcss.com/docs/customizing-spacing)
912
+ To learn more, see [Customizing Spacing](https://tailwindcss.com/docs/customizing-spacing).
900
913
 
901
- ## 核心插件
914
+ ## Core plugins
902
915
 
903
- 主题部分的其余部分用于配置每个核心插件可用的值。
916
+ The rest of the theme section is used to configure the values available for each core plugin.
904
917
 
905
- 例如,`borderRadius` 属性可让您自定义将生成的圆角的 `utilities`:
918
+ For example, the `borderRadius` property allows you to customize the ``utilities` that will generate the rounded corners.
906
919
 
907
- ```js
920
+ ``js
908
921
  const designSystem = {
909
- borderRadius: {
910
- none: '0',
911
- sm: '.125rem',
912
- default: '.25rem',
913
- lg: '.5rem',
914
- full: '9999px',
915
- },
922
+ borderRadius: {
923
+ none: '0',
924
+ sm: '.125rem',
925
+ default: '.25rem',
926
+ lg: '.5rem',
927
+ full: '9999px',
928
+ },
916
929
  };
917
- ```
918
930
 
919
- **属性名确定所生成类的后缀,值确定实际CSS声明的值。**
920
- 上面的示例`borderRadius`配置将生成以下CSS类:
931
+ ````
932
+
933
+ ** The attribute name determines the suffix of the generated class, and the value determines the value of the actual CSS declaration. **
934
+ The example ``borderRadius`` configuration above will generate the following CSS classes.
921
935
 
922
936
  ```css
923
937
  .rounded-none { border-radius: 0 }
924
- .rounded-sm { border-radius: .125rem }
925
- .rounded { border-radius: .25rem }
926
- .rounded-lg { border-radius: .5rem }
938
+ .rounded-sm { border-radius: .125rem }
939
+ .rounded { border-radius: .25rem }
940
+ .rounded-lg { border-radius: .5rem }
927
941
  .rounded-full { border-radius: 9999px }
928
- ```
942
+ ````
929
943
 
930
- 会注意到,在主题配置中使用 `default` 属性创建了不带后缀的 `rounded` 类。这是许多(尽管不是全部)核心插件支持的 Tailwind CSS 中的通用约定。
944
+ You will notice that the `rounded` class is created without the suffix in the theme configuration using the `default` attribute. This is a common convention in Tailwind CSS supported by many (though not all) of the core plugins.
931
945
 
932
- 要了解有关自定义特定核心插件的更多信息,请访问该插件的文档。
946
+ To learn more about customizing a specific core plugin, please visit the documentation for that plugin.
933
947
 
934
- ## 自定义默认配置
948
+ ## Customizing the default configuration
935
949
 
936
- 开箱即用,您的项目将自动从默认主题配置继承值。如果想自定义默认主题,则根据目标有几种不同的选择。
950
+ Out of the box, your project will automatically inherit values from the default theme configuration. If you want to customize the default theme, there are several different options depending on the goal.
937
951
 
938
- ### 覆盖默认配置
952
+ ### Override the default configuration
939
953
 
940
- 要覆盖默认配置中的选项,请在 `designSystem` 中添加要覆盖的属性:
954
+ To override the options in the default configuration, add the properties to be overridden to `designSystem` at
941
955
 
942
- ```ts modern.config.ts
956
+ ```js modern.config.ts
943
957
  import { defineConfig } from '@modern-js/module-tools';
944
958
 
945
959
  const designSystem = {
@@ -959,17 +973,17 @@ export default defineConfig({
959
973
  });
960
974
  ```
961
975
 
962
- 这将完全替换默认属性配置,因此在上面的示例中,不会生成默认的 `opacity utilities`。
976
+ This will completely replace the default property configuration, so in the above example, the default `opacity utilities` will not be generated.
963
977
 
964
- 您未提供的任何属性都将从默认主题继承,因此在上面的示例中,将保留颜色,间距,边框圆角,背景位置等内容的默认主题配置。
978
+ Any properties you do not provide will be inherited from the default theme, so in the example above, the default theme configuration for color, spacing, border rounding, background position, etc. will be retained.
965
979
 
966
- ### 扩展默认配置
980
+ ### Extending the default configuration
967
981
 
968
- 如果您想保留主题选项的默认值,但又要添加新值,请在 `designSystem.extend` 属性下添加扩展的内容。
982
+ If you want to keep the default values of the theme options but add new values, add the extensions under the `designSystem.extend` property.
969
983
 
970
- 例如,如果您想添加一个额外的断点但保留现有的断点,则可以扩展 `screens` 属性:
984
+ For example, if you want to add an additional breakpoint but keep the existing one, you can extend the `screens` property with.
971
985
 
972
- ```ts modern.config.ts
986
+ ```js modern.config.ts
973
987
  import { defineConfig } from '@modern-js/module-tools';
974
988
 
975
989
  const designSystem = {
@@ -986,9 +1000,9 @@ export default defineConfig({
986
1000
  });
987
1001
  ```
988
1002
 
989
- 您当然可以覆盖默认主题的某些部分,并在同一配置中扩展默认主题的其他部分:
1003
+ You can certainly override some parts of the default theme and extend other parts of the default theme in the same configuration: the
990
1004
 
991
- ```ts modern.config.ts
1005
+ ```js modern.config.ts
992
1006
  import { defineConfig } from '@modern-js/module-tools';
993
1007
 
994
1008
  const designSystem = {
@@ -1012,13 +1026,13 @@ export default defineConfig({
1012
1026
  });
1013
1027
  ```
1014
1028
 
1015
- ### 引用其他值
1029
+ ### Referencing other values
1016
1030
 
1017
- 如果需要在配置中引用另一个值,可以通过提供闭包函数而不是静态值来实现。函数将收到 `theme()` 函数作为参数,您可以使用该函数使用点表示法在配置中查找其他值。
1031
+ If you need to reference another value in the configuration, you can do so by providing a closure function instead of a static value. The function will receive the `theme()` function as an argument, and you can use this function to find other values in the configuration using a dot representation.
1018
1032
 
1019
- 例如,您可以在 `fill` 配置上通过引用 `theme('colors')` 为调色板中的每种颜色生成 `fill` utilities。
1033
+ For example, you can generate `fill` utilities for each color in the palette by referring to `theme('colors')` on the `fill` configuration.
1020
1034
 
1021
- ```ts modern.config.ts
1035
+ ```js modern.config.ts
1022
1036
  import { defineConfig } from '@modern-js/module-tools';
1023
1037
 
1024
1038
  const designSystem = {
@@ -1033,13 +1047,13 @@ export default defineConfig({
1033
1047
  });
1034
1048
  ```
1035
1049
 
1036
- `theme()`函数尝试从已经完全合并的配置对象中找到您要查找的值,因此它可以引用您自己的自定义设置以及默认主题值。它也可以递归工作,因此只要链末尾有一个静态值,它就可以解析您要查找的值。
1050
+ The `theme()` function tries to find the value you are looking for from an already fully merged configuration object, so it can reference your own custom settings as well as the default theme value. It also works recursively, so as long as there is a static value at the end of the chain, it can resolve the value you are looking for.
1037
1051
 
1038
- **引用默认配置**
1052
+ **Reference to the default configuration**
1039
1053
 
1040
- 如果出于任何原因想要引用默认配置中的值,则可以从 `tailwindcss/defaultTheme` 导入它。一个有用的示例是,如果要将添加默认配置提供的字体中某一个字体:
1054
+ If for any reason you want to reference a value in the default configuration, you can import it from `tailwindcss/defaultTheme`. A useful example would be to add one of the fonts provided by the default configuration to.
1041
1055
 
1042
- ```ts modern.config.ts
1056
+ ```js modern.config.ts
1043
1057
  import { defineConfig } from '@modern-js/module-tools';
1044
1058
 
1045
1059
  const defaultTheme = require('tailwindcss/defaultTheme');
@@ -1047,7 +1061,7 @@ const defaultTheme = require('tailwindcss/defaultTheme');
1047
1061
  const designSystem = {
1048
1062
  extend: {
1049
1063
  fontFamily: {
1050
- sans: ['Lato', ...defaultTheme.fontFamily.sans],
1064
+ sans: ['Lato', ... .defaultTheme.fontFamily.sans],
1051
1065
  },
1052
1066
  },
1053
1067
  };
@@ -1057,9 +1071,9 @@ export default defineConfig({
1057
1071
  });
1058
1072
  ```
1059
1073
 
1060
- ### 禁用整个核心插件
1074
+ ### Disabling the entire core plugin
1061
1075
 
1062
- 如果您不想为某个核心插件生成任何类,则最好在 `corePlugins` 配置中将该插件设置为 `false`,而不是在配置中为该属性提供一个空对象:
1076
+ If you don't want to generate any classes for a core plugin, it's better to set the plugin to `false` in the `corePlugins` configuration, rather than providing an empty object for the property in the configuration: ``
1063
1077
 
1064
1078
  ```js
1065
1079
  // Don't assign an empty object in your theme configuration
@@ -1071,18 +1085,18 @@ const designSystem = {
1071
1085
  // Do disable the plugin in your corePlugins configuration
1072
1086
  const designSyttem = {
1073
1087
  corePlugins: {
1074
- opacity: false,
1088
+ opacity: { false,
1075
1089
  },
1076
1090
  };
1077
1091
  ```
1078
1092
 
1079
- 最终结果是相同的,但是由于许多核心插件未公开任何配置,因此无论如何只能使用 corePlugins 禁用它们,最好保持一致。
1093
+ The end result is the same, but since many core plugins don't expose any configuration, it's best to keep it consistent by only disabling them with corePlugins anyway.
1080
1094
 
1081
- ### 添加自己的key
1095
+ ### Adding your own key
1082
1096
 
1083
- 在很多情况下,将自己的属性添加到配置对象可能会很有用。
1097
+ In many cases it may be useful to add your own properties to the configuration object.
1084
1098
 
1085
- 其中一个示例是添加新属性为多个核心插件之间复用。例如,您可以提取一个 `positions`对象,`backgroundPosition` `objectPosition` 插件都可以引用该对象:
1099
+ One example is to add new properties for multiplexing between multiple core plugins. For example, you can extract a `positions` object that both the `backgroundPosition` and `objectPosition` plugins can refer to.
1086
1100
 
1087
1101
  ```js
1088
1102
  const designSystem = {
@@ -1102,9 +1116,9 @@ const designSystem = {
1102
1116
  };
1103
1117
  ```
1104
1118
 
1105
- 另一个示例是在自定义插件中添加新的属性以进行引用。例如,如果您为项目编写了渐变插件,则可以向该插件引用的主题对象添加渐变属性:
1119
+ Another example is to add a new property to a custom plugin for referencing. For example, if you write a gradient plugin for your project, you can add a gradient property to the theme object referenced by that plugin.
1106
1120
 
1107
- ```ts modern.config.ts
1121
+ ```js modern.config.ts
1108
1122
  import { defineConfig } from '@modern-js/module-tools';
1109
1123
 
1110
1124
  const designSystem = {
@@ -1120,28 +1134,17 @@ export default defineConfig({
1120
1134
  buildConfig: {
1121
1135
  style: {
1122
1136
  postcss: {
1123
- plugins: [require('./plugins/gradients')],
1124
- }
1125
- }
1137
+ plugins: [require('. /plugins/gradients')],
1138
+ },
1139
+ },
1126
1140
  },
1127
1141
  });
1128
1142
  ```
1129
1143
 
1130
- ## 配置引用
1131
-
1132
- 除了 `screens`,`colors` 和 `spacing` 外,配置对象中的所有属性都映射到 `Tailwind CSS` 的核心插件上。由于许多插件负责仅接受静态值集(例如,例如`float`)的CSS属性,因此请注意,并非每个插件在主题对象中都有对应的属性。
1133
-
1134
- 所有这些属性也可以在 `designSystem.extend` 属性下使用,以扩展默认主题。
1135
-
1136
- 关于所有属性的作用,可以查看此 [链接](https://tailwindcss.com/docs/theme#configuration-reference)。
1137
-
1138
- ## 额外的配置
1139
-
1140
- 除了与 Tailwind CSS Theme 相同的配置以外,还有 Modern.js 提供的额外的配置。
1144
+ ## Configuration references
1141
1145
 
1142
- ### supportStyledComponents
1146
+ All properties in the configuration object, except `screens`, `colors` and `spacing`, are mapped to the core plugins of `Tailwind CSS`. Since many plugins are responsible for CSS properties that accept only static sets of values (e.g., e.g., `float`), please note that not every plugin has a corresponding property in the theme object.
1143
1147
 
1144
- - type: `boolean`
1145
- - default: `false`
1148
+ All of these properties can also be used under the `designSystem.extend` property to extend the default theme.
1146
1149
 
1147
- `true` 时,运行时在应用外层提供 `styled-components` `ThemeProvider` 组件,并且将通过 `designSystem` 生成的 `Theme Token` 对象注入。
1150
+ For more information about what all the properties do, check out this [link](https://tailwindcss.com/docs/theme#configuration-reference).
@@ -0,0 +1,18 @@
1
+ ---
2
+ sidebar_position: 4
3
+ ---
4
+
5
+ # Plugins
6
+
7
+ This chapter describes the configuration of the registered module-tools plugin.
8
+
9
+ - type: `Array<ModuleToolsPlugin>`
10
+
11
+ ```js modern.config.ts
12
+ import { ExamplePlugin } from '. /plugins/example';
13
+ export default defineConfig({
14
+ plugins: [ExamplePlugin()],
15
+ });
16
+ ```
17
+
18
+ For more information on how to write plugins, check out the [[Plugin Writing Guide]](/en/plugins/guide/getting-started).
@@ -1,29 +1,38 @@
1
+ ---
2
+ sidebar_position: 5
3
+ ---
4
+
1
5
  # Testing
2
6
 
7
+ This chapter describes the test-related configuration
3
8
  :::tips
4
9
  You need to enable the unit testing feature with `pnpm run new` first.
5
10
  :::
6
11
 
7
-
8
12
  ## jest
9
- * Type: `Object | Function`
10
- * Default value: `{}`
11
13
 
12
- The configuration corresponding to [Jest](https://jestjs.io/docs/configuration), when of type ``Object``, can be configured with all the underlying configurations supported by Jest .
14
+ - Type: `Object | Function`
15
+ - Default value: `{}`
16
+
17
+ The configuration corresponding to [Jest](https://jestjs.io/docs/configuration), when of type `Object`, can be configured with all the underlying configurations supported by Jest .
18
+
19
+ ```js modern.config.ts
20
+ import { defineConfig } from '@modern-js/module-tools';
13
21
 
14
- ```js title=modern.config.js
15
22
  export default defineConfig({
16
23
  testing: {
17
24
  jest: {
18
- testTimeout: 10000
19
- }
20
- }
25
+ testTimeout: 10000,
26
+ },
27
+ },
21
28
  });
22
29
  ```
23
30
 
24
- When the value is of type ``Function``, the default configuration is passed in as the first parameter and a new Jest configuration object needs to be returned.
31
+ When the value is of type `Function`, the default configuration is passed as the first parameter and a new Jest configuration object needs to be returned.
32
+
33
+ ```js modern.config.ts
34
+ import { defineConfig } from '@modern-js/module-tools';
25
35
 
26
- ```js title=modern.config.js
27
36
  export default defineConfig({
28
37
  testing: {
29
38
  jest: options => {
@@ -38,8 +47,8 @@ export default defineConfig({
38
47
 
39
48
  ## transformer
40
49
 
41
- - Type: `'babel-jest' | 'ts-jest'`
42
- - Default value: `babel-jest`
50
+ - type: `'babel-jest' | 'ts-jest'`
51
+ - Default value: `'babel-jest'`
43
52
 
44
53
  Configure the compilation tool for the source code when executing tests: [babel-jest](https://www.npmjs.com/package/babel-jest) or [ts-jest](https://github.com/kulshekhar/ts-jest). The default is `babel-jest`.
45
54
 
@@ -1,3 +1,5 @@
1
1
  ---
2
- pageType: 'api'
2
+ overview: true
3
+ sidebar_label: Overview
3
4
  ---
5
+ # Overview
@@ -0,0 +1,4 @@
1
+ {
2
+ "label": "Plugin API",
3
+ "collapsed": false
4
+ }