@modern-js/module-tools-docs 2.0.0-beta.4 → 2.0.2
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.
- package/.eslintrc.js +13 -0
- package/doc_build/html/main/index.html +16 -0
- package/doc_build/route.json +10 -0
- package/doc_build/static/css/main.css +3370 -0
- package/doc_build/static/css/main.css.map +1 -0
- package/doc_build/static/css/vendors-node_modules_pnpm_remix-run_router_1_2_0_node_modules_remix-run_router_dist_router_js-9d5e9c.css +85 -0
- package/doc_build/static/css/vendors-node_modules_pnpm_remix-run_router_1_2_0_node_modules_remix-run_router_dist_router_js-9d5e9c.css.map +1 -0
- package/doc_build/static/js/async/api_.js +56 -0
- package/doc_build/static/js/async/api_.js.map +1 -0
- package/doc_build/static/js/async/api_config_build-config.js +11309 -0
- package/doc_build/static/js/async/api_config_build-config.js.map +1 -0
- package/doc_build/static/js/async/api_config_build-preset.js +7849 -0
- package/doc_build/static/js/async/api_config_build-preset.js.map +1 -0
- package/doc_build/static/js/async/api_config_design-system.js +48708 -0
- package/doc_build/static/js/async/api_config_design-system.js.map +1 -0
- package/doc_build/static/js/async/api_config_plugins.js +1492 -0
- package/doc_build/static/js/async/api_config_plugins.js.map +1 -0
- package/doc_build/static/js/async/api_config_testing.js +2130 -0
- package/doc_build/static/js/async/api_config_testing.js.map +1 -0
- package/doc_build/static/js/async/api_plugin-api_plugin-hooks.js +14394 -0
- package/doc_build/static/js/async/api_plugin-api_plugin-hooks.js.map +1 -0
- package/doc_build/static/js/async/en_.js +85 -0
- package/doc_build/static/js/async/en_.js.map +1 -0
- package/doc_build/static/js/async/en_api_.js +55 -0
- package/doc_build/static/js/async/en_api_.js.map +1 -0
- package/doc_build/static/js/async/en_api_config_build-config.js +8363 -0
- package/doc_build/static/js/async/en_api_config_build-config.js.map +1 -0
- package/doc_build/static/js/async/en_api_config_build-preset.js +7845 -0
- package/doc_build/static/js/async/en_api_config_build-preset.js.map +1 -0
- package/doc_build/static/js/async/en_api_config_design-system.js +16345 -0
- package/doc_build/static/js/async/en_api_config_design-system.js.map +1 -0
- package/doc_build/static/js/async/en_api_config_plugins.js +1492 -0
- package/doc_build/static/js/async/en_api_config_plugins.js.map +1 -0
- package/doc_build/static/js/async/en_api_config_testing.js +2137 -0
- package/doc_build/static/js/async/en_api_config_testing.js.map +1 -0
- package/doc_build/static/js/async/en_api_plugin-api_plugin-hooks.js +14362 -0
- package/doc_build/static/js/async/en_api_plugin-api_plugin-hooks.js.map +1 -0
- package/doc_build/static/js/async/en_guide_advance_asset.js +3997 -0
- package/doc_build/static/js/async/en_guide_advance_asset.js.map +1 -0
- package/doc_build/static/js/async/en_guide_advance_build-umd.js +9861 -0
- package/doc_build/static/js/async/en_guide_advance_build-umd.js.map +1 -0
- package/doc_build/static/js/async/en_guide_advance_copy.js +6539 -0
- package/doc_build/static/js/async/en_guide_advance_copy.js.map +1 -0
- package/doc_build/static/js/async/en_guide_advance_external-dependency.js +3810 -0
- package/doc_build/static/js/async/en_guide_advance_external-dependency.js.map +1 -0
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-build.js +5046 -0
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-build.js.map +1 -0
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-dev-command.js +150 -0
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-dev-command.js.map +1 -0
- package/doc_build/static/js/async/en_guide_advance_theme-config.js +2484 -0
- package/doc_build/static/js/async/en_guide_advance_theme-config.js.map +1 -0
- package/doc_build/static/js/async/en_guide_basic_before-getting-started.js +3671 -0
- package/doc_build/static/js/async/en_guide_basic_before-getting-started.js.map +1 -0
- package/doc_build/static/js/async/en_guide_basic_command-preview.js +3961 -0
- package/doc_build/static/js/async/en_guide_basic_command-preview.js.map +1 -0
- package/doc_build/static/js/async/en_guide_basic_modify-output-product.js +2970 -0
- package/doc_build/static/js/async/en_guide_basic_modify-output-product.js.map +1 -0
- package/doc_build/static/js/async/en_guide_basic_publish-your-project.js +2182 -0
- package/doc_build/static/js/async/en_guide_basic_publish-your-project.js.map +1 -0
- package/doc_build/static/js/async/en_guide_basic_test-your-project.js +3892 -0
- package/doc_build/static/js/async/en_guide_basic_test-your-project.js.map +1 -0
- package/doc_build/static/js/async/en_guide_basic_use-micro-generator.js +168 -0
- package/doc_build/static/js/async/en_guide_basic_use-micro-generator.js.map +1 -0
- package/doc_build/static/js/async/en_guide_basic_using-storybook.js +4762 -0
- package/doc_build/static/js/async/en_guide_basic_using-storybook.js.map +1 -0
- package/doc_build/static/js/async/en_guide_best-practices_components.js +21388 -0
- package/doc_build/static/js/async/en_guide_best-practices_components.js.map +1 -0
- package/doc_build/static/js/async/en_guide_intro_getting-started.js +1906 -0
- package/doc_build/static/js/async/en_guide_intro_getting-started.js.map +1 -0
- package/doc_build/static/js/async/en_guide_intro_welcome.js +148 -0
- package/doc_build/static/js/async/en_guide_intro_welcome.js.map +1 -0
- package/doc_build/static/js/async/en_guide_intro_why-module-engineering-solution.js +92 -0
- package/doc_build/static/js/async/en_guide_intro_why-module-engineering-solution.js.map +1 -0
- package/doc_build/static/js/async/en_plugins_guide_getting-started.js +2560 -0
- package/doc_build/static/js/async/en_plugins_guide_getting-started.js.map +1 -0
- package/doc_build/static/js/async/en_plugins_guide_plugin-object.js +4177 -0
- package/doc_build/static/js/async/en_plugins_guide_plugin-object.js.map +1 -0
- package/doc_build/static/js/async/en_plugins_guide_setup-function.js +3819 -0
- package/doc_build/static/js/async/en_plugins_guide_setup-function.js.map +1 -0
- package/doc_build/static/js/async/en_plugins_official-list_overview.js +70 -0
- package/doc_build/static/js/async/en_plugins_official-list_overview.js.map +1 -0
- package/doc_build/static/js/async/guide_advance_asset.js +3997 -0
- package/doc_build/static/js/async/guide_advance_asset.js.map +1 -0
- package/doc_build/static/js/async/guide_advance_build-umd.js +9863 -0
- package/doc_build/static/js/async/guide_advance_build-umd.js.map +1 -0
- package/doc_build/static/js/async/guide_advance_copy.js +6539 -0
- package/doc_build/static/js/async/guide_advance_copy.js.map +1 -0
- package/doc_build/static/js/async/guide_advance_external-dependency.js +3812 -0
- package/doc_build/static/js/async/guide_advance_external-dependency.js.map +1 -0
- package/doc_build/static/js/async/guide_advance_in-depth-about-build.js +5046 -0
- package/doc_build/static/js/async/guide_advance_in-depth-about-build.js.map +1 -0
- package/doc_build/static/js/async/guide_advance_in-depth-about-dev-command.js +152 -0
- package/doc_build/static/js/async/guide_advance_in-depth-about-dev-command.js.map +1 -0
- package/doc_build/static/js/async/guide_advance_theme-config.js +2475 -0
- package/doc_build/static/js/async/guide_advance_theme-config.js.map +1 -0
- package/doc_build/static/js/async/guide_basic_before-getting-started.js +3662 -0
- package/doc_build/static/js/async/guide_basic_before-getting-started.js.map +1 -0
- package/doc_build/static/js/async/guide_basic_command-preview.js +3793 -0
- package/doc_build/static/js/async/guide_basic_command-preview.js.map +1 -0
- package/doc_build/static/js/async/guide_basic_modify-output-product.js +2949 -0
- package/doc_build/static/js/async/guide_basic_modify-output-product.js.map +1 -0
- package/doc_build/static/js/async/guide_basic_publish-your-project.js +2243 -0
- package/doc_build/static/js/async/guide_basic_publish-your-project.js.map +1 -0
- package/doc_build/static/js/async/guide_basic_test-your-project.js +3892 -0
- package/doc_build/static/js/async/guide_basic_test-your-project.js.map +1 -0
- package/doc_build/static/js/async/guide_basic_use-micro-generator.js +172 -0
- package/doc_build/static/js/async/guide_basic_use-micro-generator.js.map +1 -0
- package/doc_build/static/js/async/guide_basic_using-storybook.js +4762 -0
- package/doc_build/static/js/async/guide_basic_using-storybook.js.map +1 -0
- package/doc_build/static/js/async/guide_best-practices_components.js +21088 -0
- package/doc_build/static/js/async/guide_best-practices_components.js.map +1 -0
- package/doc_build/static/js/async/guide_intro_getting-started.js +1782 -0
- package/doc_build/static/js/async/guide_intro_getting-started.js.map +1 -0
- package/doc_build/static/js/async/guide_intro_welcome.js +148 -0
- package/doc_build/static/js/async/guide_intro_welcome.js.map +1 -0
- package/doc_build/static/js/async/guide_intro_why-module-engineering-solution.js +92 -0
- package/doc_build/static/js/async/guide_intro_why-module-engineering-solution.js.map +1 -0
- package/doc_build/static/js/async/index.js +85 -0
- package/doc_build/static/js/async/index.js.map +1 -0
- package/doc_build/static/js/async/packages_cli_doc-core_src_theme-default_components_Search_logic_search_ts.js +447 -0
- package/doc_build/static/js/async/packages_cli_doc-core_src_theme-default_components_Search_logic_search_ts.js.map +1 -0
- package/doc_build/static/js/async/plugins_guide_getting-started.js +2608 -0
- package/doc_build/static/js/async/plugins_guide_getting-started.js.map +1 -0
- package/doc_build/static/js/async/plugins_guide_plugin-object.js +4173 -0
- package/doc_build/static/js/async/plugins_guide_plugin-object.js.map +1 -0
- package/doc_build/static/js/async/plugins_guide_setup-function.js +3819 -0
- package/doc_build/static/js/async/plugins_guide_setup-function.js.map +1 -0
- package/doc_build/static/js/async/plugins_official-list_overview.js +70 -0
- package/doc_build/static/js/async/plugins_official-list_overview.js.map +1 -0
- package/doc_build/static/js/async/vendors-node_modules_pnpm_code-hike_mdx_0_7_4_react_18_2_0_node_modules_code-hike_mdx_dist_co-06dd41.js +6656 -0
- package/doc_build/static/js/async/vendors-node_modules_pnpm_code-hike_mdx_0_7_4_react_18_2_0_node_modules_code-hike_mdx_dist_co-06dd41.js.map +1 -0
- package/doc_build/static/js/async/vendors-node_modules_pnpm_flexsearch_0_6_32_node_modules_flexsearch_dist_flexsearch_min_js.js +54 -0
- package/doc_build/static/js/async/vendors-node_modules_pnpm_flexsearch_0_6_32_node_modules_flexsearch_dist_flexsearch_min_js.js.map +1 -0
- package/doc_build/static/js/builder-runtime.js +1375 -0
- package/doc_build/static/js/builder-runtime.js.map +1 -0
- package/doc_build/static/js/lib-lodash.js +4907 -0
- package/doc_build/static/js/lib-lodash.js.map +1 -0
- package/doc_build/static/js/lib-polyfill.js +24769 -0
- package/doc_build/static/js/lib-polyfill.js.map +1 -0
- package/doc_build/static/js/lib-react.js +39510 -0
- package/doc_build/static/js/lib-react.js.map +1 -0
- package/doc_build/static/js/main.js +9237 -0
- package/doc_build/static/js/main.js.map +1 -0
- package/doc_build/static/js/vendors-node_modules_pnpm_remix-run_router_1_2_0_node_modules_remix-run_router_dist_router_js-9d5e9c.js +8532 -0
- package/doc_build/static/js/vendors-node_modules_pnpm_remix-run_router_1_2_0_node_modules_remix-run_router_dist_router_js-9d5e9c.js.map +1 -0
- package/docs/en/api/config/_category_.json +4 -0
- package/docs/en/api/{build-config.md → config/build-config.md} +201 -108
- package/docs/en/api/{build-preset.md → config/build-preset.md} +65 -46
- package/docs/{zh/api → en/api/config}/design-system.md +130 -127
- package/docs/en/api/config/plugins.md +18 -0
- package/docs/en/api/{test.md → config/testing.md} +21 -12
- package/docs/en/api/index.md +3 -1
- package/docs/en/api/plugin-api/_category_.json +4 -0
- package/docs/en/api/plugin-api/plugin-hooks.md +501 -0
- package/docs/en/guide/advance/_category_.json +4 -0
- package/docs/en/guide/advance/asset.mdx +48 -31
- package/docs/en/guide/advance/build-umd.mdx +91 -83
- package/docs/en/guide/advance/copy.md +33 -30
- package/docs/en/guide/advance/external-dependency.mdx +27 -23
- package/docs/en/guide/advance/in-depth-about-build.md +61 -55
- package/docs/en/guide/advance/in-depth-about-dev-command.md +7 -4
- package/docs/en/guide/advance/theme-config.mdx +80 -0
- package/docs/en/guide/basic/_category_.json +4 -0
- package/docs/en/guide/basic/before-getting-started.md +29 -24
- package/docs/en/guide/basic/command-preview.md +20 -16
- package/docs/en/guide/basic/modify-output-product.md +45 -37
- package/docs/en/guide/basic/publish-your-project.md +21 -19
- package/docs/en/guide/basic/test-your-project.mdx +23 -18
- package/docs/en/guide/basic/use-micro-generator.md +15 -8
- package/docs/en/guide/basic/using-storybook.mdx +29 -26
- package/docs/en/guide/best-practices/_category_.json +4 -0
- package/docs/en/guide/best-practices/components.mdx +789 -0
- package/docs/en/guide/intro/_category_.json +4 -0
- package/docs/en/guide/intro/getting-started.md +11 -6
- package/docs/en/guide/intro/welcome.md +4 -0
- package/docs/en/guide/intro/why-module-engineering-solution.md +5 -1
- package/docs/en/index.md +15 -20
- package/docs/en/plugins/guide/_category_.json +4 -0
- package/docs/en/plugins/guide/getting-started.mdx +84 -0
- package/docs/en/plugins/guide/plugin-object.mdx +85 -0
- package/docs/en/plugins/guide/setup-function.mdx +117 -0
- package/docs/en/plugins/official-list/_category_.json +4 -0
- package/docs/en/plugins/official-list/overview.md +6 -0
- package/docs/zh/api/config/_category_.json +4 -0
- package/docs/zh/api/config/build-config.md +669 -0
- package/docs/zh/api/{build-preset.md → config/build-preset.md} +49 -36
- package/docs/zh/api/config/design-system.md +1166 -0
- package/docs/zh/api/config/plugins.md +18 -0
- package/docs/zh/api/{testing.md → config/testing.md} +18 -13
- package/docs/zh/api/index.md +5 -1
- package/docs/zh/api/plugin-api/_category_.json +4 -0
- package/docs/zh/api/plugin-api/plugin-hooks.md +501 -0
- package/docs/zh/guide/advance/_category_.json +4 -0
- package/docs/zh/guide/advance/asset.mdx +48 -31
- package/docs/zh/guide/advance/build-umd.mdx +91 -74
- package/docs/zh/guide/advance/copy.md +33 -30
- package/docs/zh/guide/advance/external-dependency.mdx +28 -24
- package/docs/zh/guide/advance/in-depth-about-build.md +60 -55
- package/docs/zh/guide/advance/in-depth-about-dev-command.md +7 -4
- package/docs/zh/guide/advance/theme-config.mdx +78 -0
- package/docs/zh/guide/basic/_category_.json +4 -0
- package/docs/zh/guide/basic/before-getting-started.md +28 -23
- package/docs/zh/guide/basic/command-preview.md +19 -15
- package/docs/zh/guide/basic/modify-output-product.md +45 -38
- package/docs/zh/guide/basic/publish-your-project.md +22 -17
- package/docs/zh/guide/basic/test-your-project.mdx +24 -18
- package/docs/zh/guide/basic/use-micro-generator.md +12 -9
- package/docs/zh/guide/basic/using-storybook.mdx +29 -24
- package/docs/zh/guide/best-practices/_category_.json +4 -0
- package/docs/zh/guide/best-practices/components.mdx +793 -0
- package/docs/zh/guide/intro/_category_.json +4 -0
- package/docs/zh/guide/intro/getting-started.md +12 -6
- package/docs/zh/guide/intro/welcome.md +4 -0
- package/docs/zh/guide/intro/why-module-engineering-solution.md +5 -1
- package/docs/zh/index.md +3 -2
- package/docs/zh/plugins/guide/_category_.json +4 -0
- package/docs/zh/plugins/guide/getting-started.mdx +84 -0
- package/docs/zh/plugins/guide/plugin-object.mdx +85 -0
- package/docs/zh/plugins/guide/setup-function.mdx +117 -0
- package/docs/zh/plugins/official-list/_category_.json +4 -0
- package/docs/zh/plugins/official-list/overview.md +5 -0
- package/modern.config.ts +119 -0
- package/package.json +8 -6
- package/{docs/.island/styles → theme}/index.css +0 -1
- package/theme/index.ts +4 -0
- package/tsconfig.json +7 -0
- package/docs/.island/config.ts +0 -245
- package/docs/.island/dist/404.html +0 -41
- package/docs/.island/dist/assets/before-getting-started.1b82b538.js +0 -87
- package/docs/.island/dist/assets/before-getting-started.582a31cc.js +0 -87
- package/docs/.island/dist/assets/build-config.72eb0918.js +0 -804
- package/docs/.island/dist/assets/build-config.d8bb1658.js +0 -809
- package/docs/.island/dist/assets/build-preset.96805d7d.js +0 -256
- package/docs/.island/dist/assets/build-preset.c20dcd40.js +0 -256
- package/docs/.island/dist/assets/build-your-ui.7f349247.js +0 -2
- package/docs/.island/dist/assets/build-your-ui.a8361604.js +0 -2
- package/docs/.island/dist/assets/command-preview.2d45fc82.js +0 -264
- package/docs/.island/dist/assets/command-preview.dc51b953.js +0 -264
- package/docs/.island/dist/assets/components.esm.03560353.js +0 -9
- package/docs/.island/dist/assets/design-system.86694ff5.js +0 -1254
- package/docs/.island/dist/assets/design-system.c4745cce.js +0 -639
- package/docs/.island/dist/assets/dev.1d326a37.js +0 -37
- package/docs/.island/dist/assets/dev.1fd06000.js +0 -37
- package/docs/.island/dist/assets/down.f35427d3.svg +0 -1
- package/docs/.island/dist/assets/extension.12299fd6.js +0 -2
- package/docs/.island/dist/assets/extension.96dc63a4.js +0 -2
- package/docs/.island/dist/assets/getting-started.40e9218d.js +0 -117
- package/docs/.island/dist/assets/getting-started.b1ed3f10.js +0 -114
- package/docs/.island/dist/assets/github.3bf8ccee.svg +0 -1
- package/docs/.island/dist/assets/index.2b2347ea.js +0 -33
- package/docs/.island/dist/assets/index.6cef6f5f.js +0 -4
- package/docs/.island/dist/assets/index.cb118238.js +0 -36
- package/docs/.island/dist/assets/index.ccb6ce27.js +0 -4
- package/docs/.island/dist/assets/island_inject.11a12ecc.js +0 -1
- package/docs/.island/dist/assets/island_inject.b13deaee.js +0 -1
- package/docs/.island/dist/assets/loading.8c9bb911.svg +0 -1
- package/docs/.island/dist/assets/modify-output-product.7f6bff35.js +0 -100
- package/docs/.island/dist/assets/modify-output-product.b91eff1f.js +0 -100
- package/docs/.island/dist/assets/moon.6b705924.svg +0 -3
- package/docs/.island/dist/assets/plugin.895932d8.js +0 -42
- package/docs/.island/dist/assets/plugin.d2fbc531.js +0 -42
- package/docs/.island/dist/assets/publish-your-project.21b8309f.js +0 -164
- package/docs/.island/dist/assets/publish-your-project.8d398b17.js +0 -166
- package/docs/.island/dist/assets/right.89674cd7.svg +0 -1
- package/docs/.island/dist/assets/search.0aea6901.svg +0 -1
- package/docs/.island/dist/assets/search.1c85d17c.js +0 -3
- package/docs/.island/dist/assets/search.484eca11.js +0 -222
- package/docs/.island/dist/assets/search.54fca8d0.js +0 -3
- package/docs/.island/dist/assets/style.09015a4b.css +0 -1
- package/docs/.island/dist/assets/style.2e5f7bc2.css +0 -1970
- package/docs/.island/dist/assets/sun.841dac10.svg +0 -11
- package/docs/.island/dist/assets/test-your-project.18bd4582.js +0 -190
- package/docs/.island/dist/assets/test-your-project.f53bebf7.js +0 -190
- package/docs/.island/dist/assets/test.0da1f99f.js +0 -67
- package/docs/.island/dist/assets/test.0e81f002.js +0 -66
- package/docs/.island/dist/assets/translator.b1077c44.svg +0 -1
- package/docs/.island/dist/assets/use-micro-generator.7d9e4016.js +0 -60
- package/docs/.island/dist/assets/use-micro-generator.db5520c1.js +0 -60
- package/docs/.island/dist/assets/using-storybook.57ea6b77.js +0 -260
- package/docs/.island/dist/assets/using-storybook.a2212f2e.js +0 -260
- package/docs/.island/dist/assets/welcome.0449a9c8.js +0 -13
- package/docs/.island/dist/assets/welcome.a8448931.js +0 -13
- package/docs/.island/dist/assets/why-module-engineering-solution.6ae8c0e3.js +0 -26
- package/docs/.island/dist/assets/why-module-engineering-solution.c9a45cbd.js +0 -26
- package/docs/.island/dist/chunk-COLCRJ2V.js +0 -1
- package/docs/.island/dist/chunk-K5FMOYDC.js +0 -10
- package/docs/.island/dist/chunk-WE42KMYS.js +0 -26
- package/docs/.island/dist/client-entry.js +0 -3
- package/docs/.island/dist/en/api/build-config.html +0 -344
- package/docs/.island/dist/en/api/build-preset.html +0 -82
- package/docs/.island/dist/en/api/design-system.html +0 -155
- package/docs/.island/dist/en/api/dev.html +0 -45
- package/docs/.island/dist/en/api/index.html +0 -41
- package/docs/.island/dist/en/api/plugin.html +0 -48
- package/docs/.island/dist/en/api/test.html +0 -58
- package/docs/.island/dist/en/guide/before-getting-started.html +0 -127
- package/docs/.island/dist/en/guide/build-your-ui.html +0 -41
- package/docs/.island/dist/en/guide/command-preview.html +0 -100
- package/docs/.island/dist/en/guide/extension.html +0 -41
- package/docs/.island/dist/en/guide/getting-started.html +0 -76
- package/docs/.island/dist/en/guide/modify-output-product.html +0 -140
- package/docs/.island/dist/en/guide/publish-your-project.html +0 -91
- package/docs/.island/dist/en/guide/test-your-project.html +0 -72
- package/docs/.island/dist/en/guide/use-micro-generator.html +0 -65
- package/docs/.island/dist/en/guide/using-storybook.html +0 -113
- package/docs/.island/dist/en/guide/welcome.html +0 -53
- package/docs/.island/dist/en/guide/why-module-engineering-solution.html +0 -49
- package/docs/.island/dist/en/index.html +0 -42
- package/docs/.island/dist/react-dom.js +0 -1
- package/docs/.island/dist/react-dom_client.js +0 -1
- package/docs/.island/dist/react.js +0 -1
- package/docs/.island/dist/react_jsx-runtime.js +0 -10
- package/docs/.island/dist/ssr-manifest.json +0 -57
- package/docs/.island/dist/test-result.png +0 -0
- package/docs/.island/dist/why-module-solution.png +0 -0
- package/docs/.island/dist/zh/api/build-config.html +0 -347
- package/docs/.island/dist/zh/api/build-preset.html +0 -82
- package/docs/.island/dist/zh/api/design-system.html +0 -149
- package/docs/.island/dist/zh/api/dev.html +0 -46
- package/docs/.island/dist/zh/api/index.html +0 -41
- package/docs/.island/dist/zh/api/plugin.html +0 -48
- package/docs/.island/dist/zh/api/test.html +0 -59
- package/docs/.island/dist/zh/guide/before-getting-started.html +0 -127
- package/docs/.island/dist/zh/guide/build-your-ui.html +0 -41
- package/docs/.island/dist/zh/guide/command-preview.html +0 -100
- package/docs/.island/dist/zh/guide/extension.html +0 -41
- package/docs/.island/dist/zh/guide/getting-started.html +0 -79
- package/docs/.island/dist/zh/guide/modify-output-product.html +0 -140
- package/docs/.island/dist/zh/guide/publish-your-project.html +0 -92
- package/docs/.island/dist/zh/guide/test-your-project.html +0 -72
- package/docs/.island/dist/zh/guide/use-micro-generator.html +0 -65
- package/docs/.island/dist/zh/guide/using-storybook.html +0 -114
- package/docs/.island/dist/zh/guide/welcome.html +0 -53
- package/docs/.island/dist/zh/guide/why-module-engineering-solution.html +0 -49
- package/docs/.island/dist/zh/index.html +0 -42
- package/docs/.island/index.html +0 -39
- package/docs/en/api/design-system.md +0 -524
- package/docs/en/api/dev.md +0 -32
- package/docs/en/api/plugin.md +0 -34
- package/docs/zh/api/build-config.md +0 -570
- package/docs/zh/api/dev.md +0 -33
- package/docs/zh/api/plugins.md +0 -108
|
@@ -0,0 +1,789 @@
|
|
|
1
|
+
# Developing Components
|
|
2
|
+
|
|
3
|
+
This chapter will describe how to develop component projects using the module engineering solution.
|
|
4
|
+
|
|
5
|
+
# # Initialize the project
|
|
6
|
+
|
|
7
|
+
<CH.Spotlight>
|
|
8
|
+
|
|
9
|
+
```bash Interactive questions
|
|
10
|
+
npx @modern-js/create components-project
|
|
11
|
+
|
|
12
|
+
? Please select the solution you want to create Module Solution
|
|
13
|
+
? Package Name components-demo
|
|
14
|
+
? Development Language TS
|
|
15
|
+
? Package Management Tool pnpm
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
It is recommended to use the `@modern-js/create` command to initialize an npm project.
|
|
21
|
+
|
|
22
|
+
```bash Interactive questions
|
|
23
|
+
npx @modern-js/create components-project
|
|
24
|
+
|
|
25
|
+
? Please select the solution you want to create Module Solution
|
|
26
|
+
? Package Name components-demo
|
|
27
|
+
? Development Language TS
|
|
28
|
+
? Package Management Tool pnpm
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
The initialized directory structure.
|
|
34
|
+
|
|
35
|
+
```bash The initialized directory structure
|
|
36
|
+
.
|
|
37
|
+
├── README.md
|
|
38
|
+
├── node_modules/
|
|
39
|
+
├── dist/
|
|
40
|
+
├── modern.config.ts
|
|
41
|
+
├── package.json
|
|
42
|
+
├── pnpm-lock.yaml
|
|
43
|
+
├── src
|
|
44
|
+
│ ├── index.ts
|
|
45
|
+
│ └── modern-app-env.d.ts
|
|
46
|
+
└── tsconfig.json
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
Modify the `. /src/index.ts` file suffix and content.
|
|
52
|
+
|
|
53
|
+
At this point, a component project is initialized.
|
|
54
|
+
|
|
55
|
+
```tsx ./src/index.tsx
|
|
56
|
+
export default () => {
|
|
57
|
+
return <div>hello world</div>;
|
|
58
|
+
};
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
</CH.Spotlight>
|
|
62
|
+
|
|
63
|
+
## Debugging code with Storybook
|
|
64
|
+
|
|
65
|
+
<CH.Spotlight>
|
|
66
|
+
|
|
67
|
+
```bash Terminal
|
|
68
|
+
pnpm run new
|
|
69
|
+
|
|
70
|
+
? Action Enable features
|
|
71
|
+
? Enable features Enable Visual Testing (Storybook)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
Execute the `new` command in the project root directory to enable the Storybook feature.
|
|
77
|
+
|
|
78
|
+
```bash Terminal
|
|
79
|
+
pnpm run new
|
|
80
|
+
|
|
81
|
+
? Action Enable features
|
|
82
|
+
? Enable features Enable Visual Testing (Storybook)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
Once successfully opened, you will see that a new dependency has been added to `package.json`. The `stories` directory and related initialization files are also created.
|
|
88
|
+
|
|
89
|
+
<CH.Code>
|
|
90
|
+
|
|
91
|
+
```json ./package.json focus=4:7
|
|
92
|
+
{
|
|
93
|
+
"name": "components-demo",
|
|
94
|
+
"devDependencies": {
|
|
95
|
+
"@modern-js/plugin-storybook": "x.y.z",
|
|
96
|
+
"@modern-js/runtime": "x.y.z",
|
|
97
|
+
"react": "^17",
|
|
98
|
+
"react-dom": "^17"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```bash Directory Structure
|
|
104
|
+
.
|
|
105
|
+
├── src
|
|
106
|
+
│ ├── index.ts
|
|
107
|
+
│ └── modern-app-env.d.ts
|
|
108
|
+
├── stories
|
|
109
|
+
│ ├── .eslintrc.js
|
|
110
|
+
│ ├── index.stories.tsx
|
|
111
|
+
│ └── tsconfig.json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
</CH.Code>
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
After initialization, the `tsconfig.json` file in the `. /stories` directory, the `tsconfig.json` file is set by default with the `paths` configuration of the same name as the project.
|
|
119
|
+
|
|
120
|
+
```json ./stories/tsconfig.json focus=5:7
|
|
121
|
+
{
|
|
122
|
+
"extends": "../tsconfig.json",
|
|
123
|
+
"compilerOptions": {
|
|
124
|
+
"baseUrl": "../",
|
|
125
|
+
"paths": {
|
|
126
|
+
"components-demo": ["./"],
|
|
127
|
+
"components-demo/*": ["./*"]
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"include": ["**/*"]
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
Such a configuration allows you to introduce code in Story code directly using the name of the project.
|
|
137
|
+
|
|
138
|
+
<CH.Code>
|
|
139
|
+
|
|
140
|
+
```tsx ./stories/index.stories.tsx
|
|
141
|
+
import Component from 'components-demo';
|
|
142
|
+
|
|
143
|
+
export const YourStory = () => <Component />;
|
|
144
|
+
|
|
145
|
+
export default {
|
|
146
|
+
title: 'Your Stories',
|
|
147
|
+
};
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
```tsx ./src/index.tsx
|
|
153
|
+
export default () => {
|
|
154
|
+
return <div>hello world</div>;
|
|
155
|
+
};
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
</CH.Code>
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
At this point Storybook identifies the entry point for the imported code based on fields like `main`, `exports` in the project's `package.json` file.
|
|
163
|
+
The location of the type file is determined by the `types` field.
|
|
164
|
+
|
|
165
|
+
```json package.json
|
|
166
|
+
{
|
|
167
|
+
"name": "components-demo",
|
|
168
|
+
"main": "./dist/esm/index.js",
|
|
169
|
+
"types": "./dist/types/index.d.ts"
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
While importing source code for debugging is also supported, debugging using project artifacts is more reliable.
|
|
176
|
+
|
|
177
|
+
Debugging with source code has a limitation: some configurations are not equivalent in Storybook and in the original build support.
|
|
178
|
+
|
|
179
|
+
**This is why debugging with the product is recommended**.
|
|
180
|
+
|
|
181
|
+
```tsx ./stories/index.stories.tsx
|
|
182
|
+
import Component from '../src';
|
|
183
|
+
|
|
184
|
+
export const YourStory = () => <Component />;
|
|
185
|
+
|
|
186
|
+
export default {
|
|
187
|
+
title: 'Your Stories',
|
|
188
|
+
};
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
</CH.Spotlight>
|
|
192
|
+
|
|
193
|
+
## Developing Styles
|
|
194
|
+
|
|
195
|
+
Next we can add styles to the component.
|
|
196
|
+
|
|
197
|
+
The following capabilities are currently supported for developing styles.
|
|
198
|
+
|
|
199
|
+
- CSS/PostCSS
|
|
200
|
+
- Less
|
|
201
|
+
- Scss/Sass
|
|
202
|
+
- Tailwind CSS
|
|
203
|
+
- CSS Modules
|
|
204
|
+
|
|
205
|
+
### CSS/PostCSS
|
|
206
|
+
|
|
207
|
+
The module project supports PostCSS and has the following built-in postcss plugins.
|
|
208
|
+
|
|
209
|
+
- [flexbugs-fixes](https://github.com/luisrudge/postcss-flexbugs-fixes)
|
|
210
|
+
- [custom-properties](https://github.com/postcss/postcss-custom-properties)
|
|
211
|
+
- [initial](https://github.com/maximkoretskiy/postcss-initial)
|
|
212
|
+
- [page-break](https://github.com/shrpne/postcss-page-break)
|
|
213
|
+
- [font-variant](https://github.com/postcss/postcss-font-variant)
|
|
214
|
+
- [media-minmax](https://github.com/postcss/postcss-media-minmax)
|
|
215
|
+
- [nesting](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting#readme)
|
|
216
|
+
|
|
217
|
+
So we can create `.css` files in our projects and use the syntax support and capabilities provided by these plugins directly in our css files.
|
|
218
|
+
|
|
219
|
+
<CH.Spotlight>
|
|
220
|
+
|
|
221
|
+
```css ./src/index.css
|
|
222
|
+
a,
|
|
223
|
+
b {
|
|
224
|
+
color: red;
|
|
225
|
+
|
|
226
|
+
/* "&" comes first */
|
|
227
|
+
& c,
|
|
228
|
+
& d {
|
|
229
|
+
color: white;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/* "&" comes later, requiring "@nest" */
|
|
233
|
+
@nest e & {
|
|
234
|
+
color: yellow;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
Source Code.
|
|
242
|
+
|
|
243
|
+
```css ./src/index.css
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
css product.
|
|
250
|
+
|
|
251
|
+
```css ./dist/es/index.css
|
|
252
|
+
a,
|
|
253
|
+
b {
|
|
254
|
+
color: red;
|
|
255
|
+
}
|
|
256
|
+
a c,
|
|
257
|
+
b c,
|
|
258
|
+
a d,
|
|
259
|
+
b d {
|
|
260
|
+
color: white;
|
|
261
|
+
}
|
|
262
|
+
e a,
|
|
263
|
+
e b {
|
|
264
|
+
color: yellow;
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
</CH.Spotlight>
|
|
269
|
+
|
|
270
|
+
### Less
|
|
271
|
+
|
|
272
|
+
Module projects support development styles using Less.
|
|
273
|
+
|
|
274
|
+
> Currently supported version is 4.1.3
|
|
275
|
+
|
|
276
|
+
<CH.Spotlight>
|
|
277
|
+
|
|
278
|
+
```less ./src/common.less
|
|
279
|
+
@bg: black;
|
|
280
|
+
@bg-light: boolean(luma(@bg) > 50%);
|
|
281
|
+
|
|
282
|
+
div {
|
|
283
|
+
background: @bg;
|
|
284
|
+
color: if(@bg-light, black, white);
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
Source Code.
|
|
291
|
+
|
|
292
|
+
```less ./src/common.less
|
|
293
|
+
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
Less product.
|
|
299
|
+
|
|
300
|
+
```css ./dist/es/common.css
|
|
301
|
+
div {
|
|
302
|
+
background: black;
|
|
303
|
+
color: white;
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
</CH.Spotlight>
|
|
308
|
+
|
|
309
|
+
### Sass/Scss
|
|
310
|
+
|
|
311
|
+
Module projects support developing styles using Scss/Sass.
|
|
312
|
+
|
|
313
|
+
> Currently supported version is 1.54.4
|
|
314
|
+
|
|
315
|
+
<CH.Spotlight>
|
|
316
|
+
|
|
317
|
+
```sass ./src/common.sass
|
|
318
|
+
$font-stack: Helvetica, sans-serif;
|
|
319
|
+
$primary-color: #333;
|
|
320
|
+
|
|
321
|
+
body {
|
|
322
|
+
font: 100% $font-stack;
|
|
323
|
+
color: $primary-color;
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
源代码。
|
|
330
|
+
|
|
331
|
+
```sass ./src/common.sass
|
|
332
|
+
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
Less product.
|
|
338
|
+
|
|
339
|
+
```css ./dist/es/common.css
|
|
340
|
+
body {
|
|
341
|
+
font: 100% Helvetica, sans-serif;
|
|
342
|
+
color: #333;
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
</CH.Spotlight>
|
|
347
|
+
|
|
348
|
+
### Tailwind CSS
|
|
349
|
+
|
|
350
|
+
The module project supports the development of component styles using Tailwind CSS.
|
|
351
|
+
|
|
352
|
+
By default, this feature is not enabled in the module project, you need to enable it as follows.
|
|
353
|
+
|
|
354
|
+
<CH.Spotlight>
|
|
355
|
+
|
|
356
|
+
```bash Terminal
|
|
357
|
+
pnpm run new
|
|
358
|
+
|
|
359
|
+
? Action Enable features
|
|
360
|
+
? Enable features Enable Visual Testing (Storybook)
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
The Tailwind CSS feature can be enabled by executing the `new` command in the project root directory.
|
|
366
|
+
|
|
367
|
+
```bash Terminal
|
|
368
|
+
pnpm run new
|
|
369
|
+
|
|
370
|
+
? Action Enable features
|
|
371
|
+
? Enable features Enable Tailwind CSS
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
Once successfully opened, you will see that a new dependency has been added to `package.json`.
|
|
377
|
+
|
|
378
|
+
```json ./package.json
|
|
379
|
+
{
|
|
380
|
+
"devDependencies": {
|
|
381
|
+
"@modern-js/plugin-tailwindcss": "x.y.z"
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
</CH.Spotlight>
|
|
387
|
+
|
|
388
|
+
Tailwind CSS offers two ways to use it.
|
|
389
|
+
|
|
390
|
+
#### HTML class
|
|
391
|
+
|
|
392
|
+
<CH.Spotlight>
|
|
393
|
+
|
|
394
|
+
```tsx ./src/index.tsx
|
|
395
|
+
import 'tailwindcss/utilities.css';
|
|
396
|
+
|
|
397
|
+
export default () => {
|
|
398
|
+
return <div className="bg-black text-white">hello world</div>;
|
|
399
|
+
};
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
Tailwind CSS supports adding styles to HTML tags by using class names.
|
|
405
|
+
|
|
406
|
+
```tsx ./src/index.tsx focus=5:5
|
|
407
|
+
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
**When using HTML class names, be sure to import the Tailwind CSS equivalent css file. **
|
|
413
|
+
|
|
414
|
+
```tsx ./src/index.tsx focus=1:1
|
|
415
|
+
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
Style product.
|
|
421
|
+
|
|
422
|
+
> This is a bundle build.
|
|
423
|
+
|
|
424
|
+
```css ./dist/es/index.css
|
|
425
|
+
/* ../../node_modules/.pnpm/tailwindcss@2.2.19/node_modules/tailwindcss/utilities.css */
|
|
426
|
+
.table {
|
|
427
|
+
display: table;
|
|
428
|
+
}
|
|
429
|
+
@keyframes spin {
|
|
430
|
+
to {
|
|
431
|
+
transform: rotate(360deg);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
@keyframes ping {
|
|
435
|
+
75%,
|
|
436
|
+
100% {
|
|
437
|
+
transform: scale(2);
|
|
438
|
+
opacity: 0;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
@keyframes pulse {
|
|
442
|
+
50% {
|
|
443
|
+
opacity: 0.5;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
@keyframes bounce {
|
|
447
|
+
0%,
|
|
448
|
+
100% {
|
|
449
|
+
transform: translateY(-25%);
|
|
450
|
+
animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
|
|
451
|
+
}
|
|
452
|
+
50% {
|
|
453
|
+
transform: none;
|
|
454
|
+
animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
.bg-black {
|
|
458
|
+
--tw-bg-opacity: 1;
|
|
459
|
+
background-color: rgba(0, 0, 0, var(--tw-bg-opacity));
|
|
460
|
+
}
|
|
461
|
+
.text-white {
|
|
462
|
+
--tw-text-opacity: 1;
|
|
463
|
+
color: rgba(255, 255, 255, var(--tw-text-opacity));
|
|
464
|
+
}
|
|
465
|
+
*,
|
|
466
|
+
::before,
|
|
467
|
+
::after {
|
|
468
|
+
--tw-shadow: 0 0 #0000;
|
|
469
|
+
}
|
|
470
|
+
*,
|
|
471
|
+
::before,
|
|
472
|
+
::after {
|
|
473
|
+
--tw-ring-inset: var(--tw-empty);
|
|
474
|
+
--tw-ring-offset-width: 0px;
|
|
475
|
+
--tw-ring-offset-color: #fff;
|
|
476
|
+
--tw-ring-color: rgba(59, 130, 246, 0.5);
|
|
477
|
+
--tw-ring-offset-shadow: 0 0 #0000;
|
|
478
|
+
--tw-ring-shadow: 0 0 #0000;
|
|
479
|
+
}
|
|
480
|
+
@media (min-width: 640px) {
|
|
481
|
+
}
|
|
482
|
+
@media (min-width: 768px) {
|
|
483
|
+
}
|
|
484
|
+
@media (min-width: 1024px) {
|
|
485
|
+
}
|
|
486
|
+
@media (min-width: 1280px) {
|
|
487
|
+
}
|
|
488
|
+
@media (min-width: 1536px) {
|
|
489
|
+
}
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
</CH.Spotlight>
|
|
493
|
+
|
|
494
|
+
#### `@apply`
|
|
495
|
+
|
|
496
|
+
Tailwind CSS provides the [`@apply`](https://v2.tailwindcss.com/docs/functions-and-directives#apply) directive, which allows us to inline the styles provided by Tailwind CSS into the styles we write.
|
|
497
|
+
|
|
498
|
+
`@apply` can be used in CSS, Less, and Sass.
|
|
499
|
+
|
|
500
|
+
```css
|
|
501
|
+
.btn {
|
|
502
|
+
@apply font-bold py-2 px-4 rounded;
|
|
503
|
+
}
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
However, there are some things to keep in mind when using Less and Sass.
|
|
507
|
+
|
|
508
|
+
##### Sass
|
|
509
|
+
|
|
510
|
+
When using Tailwind with Sass, the presence of `!important` after `@apply` requires interpolation to get Sass to compile correctly.
|
|
511
|
+
|
|
512
|
+
<CH.Spotlight>
|
|
513
|
+
|
|
514
|
+
```sass
|
|
515
|
+
.alert {
|
|
516
|
+
@apply bg-red-500 !important;
|
|
517
|
+
}
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
---
|
|
521
|
+
|
|
522
|
+
It does not work properly.
|
|
523
|
+
|
|
524
|
+
```sass
|
|
525
|
+
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
---
|
|
529
|
+
|
|
530
|
+
Can work properly.
|
|
531
|
+
|
|
532
|
+
```sass
|
|
533
|
+
.alert {
|
|
534
|
+
@apply bg-red-500 #{!important};
|
|
535
|
+
}
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
</CH.Spotlight>
|
|
539
|
+
|
|
540
|
+
##### Less
|
|
541
|
+
|
|
542
|
+
When using Tailwind with Less, you cannot nest Tailwind's `@screen` directive.
|
|
543
|
+
|
|
544
|
+
<CH.Spotlight>
|
|
545
|
+
|
|
546
|
+
```less
|
|
547
|
+
.card {
|
|
548
|
+
@apply rounded-none;
|
|
549
|
+
|
|
550
|
+
@screen sm {
|
|
551
|
+
@apply rounded-lg;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
---
|
|
557
|
+
|
|
558
|
+
It does not work properly.
|
|
559
|
+
|
|
560
|
+
```less
|
|
561
|
+
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
---
|
|
565
|
+
|
|
566
|
+
Instead, use regular media queries and the `theme()` function to reference your screen size, or simply don't nest your `@screen` directive.
|
|
567
|
+
|
|
568
|
+
<CH.Code>
|
|
569
|
+
|
|
570
|
+
```less Method One
|
|
571
|
+
// Use a regular media query and theme()
|
|
572
|
+
.card {
|
|
573
|
+
@apply rounded-none;
|
|
574
|
+
|
|
575
|
+
@media (min-width: theme('screens.sm')) {
|
|
576
|
+
@apply rounded-lg;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
---
|
|
582
|
+
|
|
583
|
+
```less Method Two
|
|
584
|
+
// Use the @screen directive at the top-level
|
|
585
|
+
.card {
|
|
586
|
+
@apply rounded-none;
|
|
587
|
+
|
|
588
|
+
@media (min-width: theme('screens.sm')) {
|
|
589
|
+
@apply rounded-lg;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
</CH.Code>
|
|
595
|
+
|
|
596
|
+
</CH.Spotlight>
|
|
597
|
+
|
|
598
|
+
#### Recommended method
|
|
599
|
+
|
|
600
|
+
**It is recommended to develop styles in the way specified by `@apply`, so that only styles inlined by directives are included in the style product. **
|
|
601
|
+
|
|
602
|
+
When adding styles using HTML class names, by default Tailwind will not only add the styles corresponding to its own class name to the product, but will also have additional style code that may not affect its own styles.
|
|
603
|
+
|
|
604
|
+
#### The difference between bundle and bundleless build products
|
|
605
|
+
|
|
606
|
+
For the following code, there is a big difference between the bundle and bundleless modes of building products.
|
|
607
|
+
|
|
608
|
+
> The so-called bundle and bundleless can be found in [[Bundle and Bundleless]](/en/guide/advance/in-depth-about-build#bundle- and-bundleless)
|
|
609
|
+
|
|
610
|
+
```tsx ./src/index.tsx
|
|
611
|
+
import 'tailwindcss/utilities.css';
|
|
612
|
+
|
|
613
|
+
export default () => {
|
|
614
|
+
return <div className="bg-black text-white">hello world11</div>;
|
|
615
|
+
};
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
In Bundle mode, third-party dependencies are packaged in.
|
|
619
|
+
|
|
620
|
+
For styles, a separate product file is generated, and there is no code related to importing styles in the Js product file.
|
|
621
|
+
|
|
622
|
+
If you need to inject styles into Js products, you can enable the [`style.inject` API](/en/api/config/build-config#inject).
|
|
623
|
+
|
|
624
|
+
<CH.Code>
|
|
625
|
+
```css ./dist/es/index.css
|
|
626
|
+
/* ../../node_modules/.pnpm/tailwindcss@2.2.19/node_modules/tailwindcss/utilities.css */
|
|
627
|
+
.table {
|
|
628
|
+
display: table;
|
|
629
|
+
}
|
|
630
|
+
@keyframes spin {
|
|
631
|
+
to {
|
|
632
|
+
transform: rotate(360deg);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
@keyframes ping {
|
|
636
|
+
75%, 100% {
|
|
637
|
+
transform: scale(2);
|
|
638
|
+
opacity: 0;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
@keyframes pulse {
|
|
642
|
+
50% {
|
|
643
|
+
opacity: .5;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
@keyframes bounce {
|
|
647
|
+
0%, 100% {
|
|
648
|
+
transform: translateY(-25%);
|
|
649
|
+
animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
|
|
650
|
+
}
|
|
651
|
+
50% {
|
|
652
|
+
transform: none;
|
|
653
|
+
animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
.bg-black {
|
|
657
|
+
--tw-bg-opacity: 1;
|
|
658
|
+
background-color: rgba(0, 0, 0, var(--tw-bg-opacity));
|
|
659
|
+
}
|
|
660
|
+
.text-white {
|
|
661
|
+
--tw-text-opacity: 1;
|
|
662
|
+
color: rgba(255, 255, 255, var(--tw-text-opacity));
|
|
663
|
+
}
|
|
664
|
+
*,
|
|
665
|
+
::before,
|
|
666
|
+
::after {
|
|
667
|
+
--tw-shadow: 0 0 #0000 ;
|
|
668
|
+
}
|
|
669
|
+
*,
|
|
670
|
+
::before,
|
|
671
|
+
::after {
|
|
672
|
+
--tw-ring-inset: var(--tw-empty, );
|
|
673
|
+
--tw-ring-offset-width: 0px;
|
|
674
|
+
--tw-ring-offset-color: #fff;
|
|
675
|
+
--tw-ring-color: rgba(59, 130, 246, 0.5);
|
|
676
|
+
--tw-ring-offset-shadow: 0 0 #0000;
|
|
677
|
+
--tw-ring-shadow: 0 0 #0000 ;
|
|
678
|
+
}
|
|
679
|
+
@media (min-width: 640px) {
|
|
680
|
+
}
|
|
681
|
+
@media (min-width: 768px) {
|
|
682
|
+
}
|
|
683
|
+
@media (min-width: 1024px) {
|
|
684
|
+
}
|
|
685
|
+
@media (min-width: 1280px) {
|
|
686
|
+
}
|
|
687
|
+
@media (min-width: 1536px) {
|
|
688
|
+
}
|
|
689
|
+
```
|
|
690
|
+
---
|
|
691
|
+
``` js ./dist/es/index.js
|
|
692
|
+
// src/index.tsx
|
|
693
|
+
import { jsx } from "react/jsx-runtime";
|
|
694
|
+
var src_default = () => {
|
|
695
|
+
return /* @__PURE__ */ jsx("div", {
|
|
696
|
+
className: "bg-black text-white",
|
|
697
|
+
children: "hello world11"
|
|
698
|
+
});
|
|
699
|
+
};
|
|
700
|
+
export {
|
|
701
|
+
src_default as default
|
|
702
|
+
};
|
|
703
|
+
```
|
|
704
|
+
</CH.Code>
|
|
705
|
+
|
|
706
|
+
In Bundleless mode, no third-party dependencies are packaged in, and no style products are generated at this time.
|
|
707
|
+
|
|
708
|
+
```js ./dist/es/index.js
|
|
709
|
+
import { jsx } from 'react/jsx-runtime';
|
|
710
|
+
import 'tailwindcss/utilities.css';
|
|
711
|
+
var src_default = () => {
|
|
712
|
+
return /* @__PURE__ */ jsx('div', {
|
|
713
|
+
className: 'bg-black text-white',
|
|
714
|
+
children: 'hello world11',
|
|
715
|
+
});
|
|
716
|
+
};
|
|
717
|
+
export { src_default as default };
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
### CSS Modules
|
|
721
|
+
|
|
722
|
+
Module projects support the development of styles using CSS Modules. By default, the following files are recognized as CSS Module files.
|
|
723
|
+
|
|
724
|
+
- `.module.css`
|
|
725
|
+
- `.module.less`
|
|
726
|
+
- `.module.scss`
|
|
727
|
+
- `.module.sass`
|
|
728
|
+
|
|
729
|
+
If you need to configure CSS Modules, you can check out the API at
|
|
730
|
+
|
|
731
|
+
- [autoModules](en/api/config/build-config#automodules)
|
|
732
|
+
- [modules](/en/api/config/build-config#modules)
|
|
733
|
+
|
|
734
|
+
The following is a code example.
|
|
735
|
+
|
|
736
|
+
<CH.Code>
|
|
737
|
+
|
|
738
|
+
```tsx ./src/index.tsx
|
|
739
|
+
import style from './index.module.css';
|
|
740
|
+
|
|
741
|
+
export default () => {
|
|
742
|
+
return <div className={style.btn}>hello world</div>;
|
|
743
|
+
};
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
```css ./src/index.module.css
|
|
747
|
+
.btn {
|
|
748
|
+
color: blue;
|
|
749
|
+
}
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
</CH.Code>
|
|
753
|
+
|
|
754
|
+
## Configuring build products
|
|
755
|
+
|
|
756
|
+
Based on most scenarios of component project usage, **it is recommended to use the `npm-component` build preset**. This preset yields a product directory structure of
|
|
757
|
+
|
|
758
|
+
```bash
|
|
759
|
+
.
|
|
760
|
+
├── dist
|
|
761
|
+
│ ├── es
|
|
762
|
+
│ ├── lib
|
|
763
|
+
│ └── types
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
- `. /dist/es`: Contains bundleless products in ES modules format that support the es6 syntax.
|
|
767
|
+
- `. /dist/lib`: Contains bundleless products in CommonJS format with support for es6 syntax.
|
|
768
|
+
- `. /dist/types`: Contains the types file.
|
|
769
|
+
|
|
770
|
+
The [`buildPreset`](/en/api/config/build-preset) can be configured manually if there is a requirement to use syntax support, and supports modifying the supported syntax by adding a suffix to `npm-component`.
|
|
771
|
+
|
|
772
|
+
```tsx
|
|
773
|
+
export default defineConfig({
|
|
774
|
+
buildPreset: 'npm-component-es2019',
|
|
775
|
+
});
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
If you have special needs for the build product directory structure, you can use the [`buildConfig` API](/en/api/config/build-config), which can be used by the following documentation.
|
|
779
|
+
|
|
780
|
+
- [modify-output-product](/en/guide/basic/modify-output-product#build-configuration-object)
|
|
781
|
+
- [in-depth-about-build](/en/guide/advance/in-depth-about-build)
|
|
782
|
+
|
|
783
|
+
## Testing components
|
|
784
|
+
|
|
785
|
+
For more information on how to test components, please refer to [[Test project]](/en/guide/basic/test-your-project).
|
|
786
|
+
|
|
787
|
+
## Releasing components
|
|
788
|
+
|
|
789
|
+
It is recommended to use module project to provide version publishing function, you can refer to [[Versioning and publishing]](/en/guide/basic/publish-your-project).
|