├── examples ├── taro4_vite_vue3 │ ├── src │ │ ├── app.less │ │ ├── pages │ │ │ ├── index │ │ │ │ └── index.config.ts │ │ │ ├── bg │ │ │ │ └── logo.png │ │ │ ├── icon │ │ │ │ └── index.vue │ │ │ ├── shortcuts │ │ │ │ └── index.vue │ │ │ ├── font │ │ │ │ ├── components │ │ │ │ │ ├── TextAlign.vue │ │ │ │ │ ├── TextDecoration.vue │ │ │ │ │ ├── LineHeight.vue │ │ │ │ │ ├── TextShadow.vue │ │ │ │ │ ├── TextDecorationStyle.vue │ │ │ │ │ ├── LetterSpacing.vue │ │ │ │ │ ├── FontBold.vue │ │ │ │ │ ├── FontSize.vue │ │ │ │ │ └── TextIndent.vue │ │ │ │ └── index.vue │ │ │ ├── border │ │ │ │ ├── index.vue │ │ │ │ └── components │ │ │ │ │ └── BorderStyle.vue │ │ │ ├── odd-even │ │ │ │ └── index.vue │ │ │ ├── color │ │ │ │ └── index.vue │ │ │ └── first-last │ │ │ │ └── index.vue │ │ ├── app.ts │ │ ├── index.html │ │ └── app.config.ts │ ├── .env.test │ ├── .env.production │ ├── .env.development │ ├── .gitignore │ ├── .eslintrc │ ├── config │ │ └── dev.ts │ ├── .editorconfig │ ├── babel.config.js │ ├── types │ │ ├── vue.d.ts │ │ └── global.d.ts │ ├── project.config.json │ ├── tsconfig.json │ └── unocss.config.ts ├── taro4_webpack5_vue3 │ ├── src │ │ ├── app.less │ │ ├── pages │ │ │ ├── index │ │ │ │ └── index.config.ts │ │ │ ├── bg │ │ │ │ └── logo.png │ │ │ ├── icon │ │ │ │ └── index.vue │ │ │ ├── shortcuts │ │ │ │ └── index.vue │ │ │ ├── font │ │ │ │ ├── components │ │ │ │ │ ├── TextAlign.vue │ │ │ │ │ ├── TextDecoration.vue │ │ │ │ │ ├── LineHeight.vue │ │ │ │ │ ├── TextShadow.vue │ │ │ │ │ ├── TextDecorationStyle.vue │ │ │ │ │ ├── LetterSpacing.vue │ │ │ │ │ ├── FontBold.vue │ │ │ │ │ ├── FontSize.vue │ │ │ │ │ └── TextIndent.vue │ │ │ │ └── index.vue │ │ │ ├── border │ │ │ │ ├── index.vue │ │ │ │ └── components │ │ │ │ │ └── BorderStyle.vue │ │ │ ├── odd-even │ │ │ │ └── index.vue │ │ │ ├── color │ │ │ │ └── index.vue │ │ │ └── first-last │ │ │ │ └── index.vue │ │ ├── app.ts │ │ ├── index.html │ │ └── app.config.ts │ ├── .env.test │ ├── .env.production │ ├── .env.development │ ├── .gitignore │ ├── .eslintrc │ ├── config │ │ └── dev.ts │ ├── .editorconfig │ ├── babel.config.js │ ├── types │ │ ├── vue.d.ts │ │ └── global.d.ts │ ├── project.config.json │ └── tsconfig.json ├── taro_webpack4_vue3 │ ├── src │ │ ├── app.css │ │ ├── pages │ │ │ ├── bg │ │ │ │ └── logo.png │ │ │ ├── icon │ │ │ │ └── index.vue │ │ │ ├── shortcuts │ │ │ │ └── index.vue │ │ │ ├── font │ │ │ │ ├── components │ │ │ │ │ ├── TextAlign.vue │ │ │ │ │ ├── TextDecoration.vue │ │ │ │ │ ├── LineHeight.vue │ │ │ │ │ ├── TextShadow.vue │ │ │ │ │ ├── TextDecorationStyle.vue │ │ │ │ │ ├── LetterSpacing.vue │ │ │ │ │ ├── FontBold.vue │ │ │ │ │ ├── FontSize.vue │ │ │ │ │ └── TextIndent.vue │ │ │ │ └── index.vue │ │ │ ├── border │ │ │ │ ├── index.vue │ │ │ │ └── components │ │ │ │ │ └── BorderStyle.vue │ │ │ ├── odd-even │ │ │ │ └── index.vue │ │ │ ├── rpxTranform │ │ │ │ └── index.vue │ │ │ ├── color │ │ │ │ └── index.vue │ │ │ ├── first-last │ │ │ │ └── index.vue │ │ │ ├── shadow │ │ │ │ └── index.vue │ │ │ └── attributify-mode │ │ │ │ └── index.vue │ │ ├── app.ts │ │ ├── app.config.ts │ │ └── index.html │ ├── .gitignore │ ├── .eslintrc │ ├── config │ │ ├── dev.js │ │ └── prod.js │ ├── .editorconfig │ ├── babel.config.js │ ├── project.config.json │ ├── global.d.ts │ ├── tsconfig.json │ └── unocss.config.ts ├── taro_webpack5_react │ ├── src │ │ ├── pages │ │ │ ├── index │ │ │ │ ├── index.css │ │ │ │ ├── index.config.ts │ │ │ │ └── index.tsx │ │ │ ├── directives │ │ │ │ └── index.tsx │ │ │ ├── shortcuts │ │ │ │ └── index.tsx │ │ │ ├── border │ │ │ │ ├── index.tsx │ │ │ │ └── components │ │ │ │ │ └── BorderStyle.tsx │ │ │ ├── font │ │ │ │ ├── components │ │ │ │ │ ├── TextAlign.tsx │ │ │ │ │ ├── TextDecoration.tsx │ │ │ │ │ ├── LineHeight.tsx │ │ │ │ │ ├── TextShadow.tsx │ │ │ │ │ ├── TextDecorationStyle.tsx │ │ │ │ │ ├── LetterSpacing.tsx │ │ │ │ │ ├── FontBold.tsx │ │ │ │ │ ├── FontSize.tsx │ │ │ │ │ └── TextIndent.tsx │ │ │ │ └── index.tsx │ │ │ └── shadow │ │ │ │ └── index.tsx │ │ ├── app.css │ │ ├── app.ts │ │ ├── app.config.ts │ │ └── index.html │ ├── .gitignore │ ├── .eslintrc │ ├── config │ │ ├── dev.js │ │ └── prod.js │ ├── project.tt.json │ ├── .editorconfig │ ├── babel.config.js │ ├── project.config.json │ ├── types │ │ └── global.d.ts │ ├── tsconfig.json │ └── unocss.config.ts ├── uniapp_vue3 │ ├── .npmrc │ ├── .eslintrc │ ├── src │ │ ├── static │ │ │ └── logo.png │ │ ├── main.ts │ │ ├── pages │ │ │ ├── bg │ │ │ │ └── components │ │ │ │ │ └── xxClass.vue │ │ │ ├── icon │ │ │ │ └── index.vue │ │ │ ├── shortcuts │ │ │ │ └── index.vue │ │ │ ├── font │ │ │ │ └── components │ │ │ │ │ ├── TextAlign.vue │ │ │ │ │ ├── TextDecoration.vue │ │ │ │ │ ├── LineHeight.vue │ │ │ │ │ ├── TextShadow.vue │ │ │ │ │ ├── TextDecorationStyle.vue │ │ │ │ │ ├── LetterSpacing.vue │ │ │ │ │ ├── FontBold.vue │ │ │ │ │ ├── TextIndent.vue │ │ │ │ │ └── FontSize.vue │ │ │ ├── border │ │ │ │ ├── index.vue │ │ │ │ └── components │ │ │ │ │ └── BorderStyle.vue │ │ │ ├── odd-even │ │ │ │ └── index.vue │ │ │ ├── apply │ │ │ │ └── index.vue │ │ │ ├── first-last │ │ │ │ └── index.vue │ │ │ └── color │ │ │ │ └── index.vue │ │ ├── env.d.ts │ │ └── App.vue │ ├── vite.config.ts │ ├── tsconfig.json │ ├── .hbuilderx │ │ └── launch.json │ └── index.html ├── taro_webpack5_vue3 │ ├── .npmrc │ ├── .gitignore │ ├── src │ │ ├── pages │ │ │ ├── index │ │ │ │ └── index.config.ts │ │ │ ├── bg │ │ │ │ └── logo.png │ │ │ ├── icon │ │ │ │ └── index.vue │ │ │ ├── shortcuts │ │ │ │ └── index.vue │ │ │ ├── font │ │ │ │ ├── components │ │ │ │ │ ├── TextAlign.vue │ │ │ │ │ ├── TextDecoration.vue │ │ │ │ │ ├── LineHeight.vue │ │ │ │ │ ├── TextShadow.vue │ │ │ │ │ ├── TextDecorationStyle.vue │ │ │ │ │ ├── LetterSpacing.vue │ │ │ │ │ ├── FontBold.vue │ │ │ │ │ ├── FontSize.vue │ │ │ │ │ └── TextIndent.vue │ │ │ │ └── index.vue │ │ │ ├── border │ │ │ │ ├── index.vue │ │ │ │ └── components │ │ │ │ │ └── BorderStyle.vue │ │ │ ├── odd-even │ │ │ │ └── index.vue │ │ │ ├── color │ │ │ │ └── index.vue │ │ │ ├── first-last │ │ │ │ └── index.vue │ │ │ ├── attributify-mode │ │ │ │ └── index.vue │ │ │ └── rpxTranform │ │ │ │ └── index.vue │ │ ├── app.css │ │ ├── app.ts │ │ ├── index.html │ │ └── app.config.ts │ ├── config │ │ ├── dev.js │ │ └── prod.js │ ├── project.tt.json │ ├── project.config.json │ ├── README.md │ ├── babel.config.js │ ├── types │ │ └── global.d.ts │ └── tsconfig.json ├── uniapp_vue2 │ ├── src │ │ ├── static │ │ │ └── logo.png │ │ ├── main.js │ │ ├── pages │ │ │ ├── shortcuts │ │ │ │ └── index.vue │ │ │ ├── font │ │ │ │ └── components │ │ │ │ │ ├── TextAlign.vue │ │ │ │ │ ├── TextDecoration.vue │ │ │ │ │ ├── LineHeight.vue │ │ │ │ │ ├── TextShadow.vue │ │ │ │ │ ├── TextDecorationStyle.vue │ │ │ │ │ ├── LetterSpacing.vue │ │ │ │ │ ├── FontBold.vue │ │ │ │ │ ├── FontSize.vue │ │ │ │ │ └── TextIndent.vue │ │ │ ├── border │ │ │ │ ├── index.vue │ │ │ │ └── components │ │ │ │ │ └── BorderStyle.vue │ │ │ ├── odd-even │ │ │ │ └── index.vue │ │ │ ├── first-last │ │ │ │ └── index.vue │ │ │ ├── attributify-mode │ │ │ │ └── index.vue │ │ │ └── color │ │ │ │ └── index.vue │ │ └── App.vue │ ├── jsconfig.json │ ├── sfc.d.ts │ ├── vue.config.js │ ├── .gitignore │ ├── .hbuilderx │ │ └── launch.json │ ├── postcss.config.js │ ├── public │ │ └── index.html │ └── unocss.config.js └── vue2_example │ ├── src │ ├── static │ │ └── logo.png │ ├── main.js │ ├── App.vue │ ├── pages.json │ └── pages │ │ └── index │ │ └── index.vue │ ├── jsconfig.json │ ├── vue.config.js │ ├── sfc.d.ts │ ├── .gitignore │ ├── unocss.config.js │ ├── postcss.config.js │ └── public │ └── index.html ├── rules.d.ts ├── theme.d.ts ├── utils.d.ts ├── colors.d.ts ├── src ├── colors.ts ├── rules.ts ├── theme.ts ├── utils.ts ├── variants.ts ├── transformer.ts ├── rules │ ├── constant.ts │ ├── container.ts │ ├── safe-area.ts │ ├── question-mark.ts │ ├── layout.ts │ ├── line-clamp.ts │ ├── index.ts │ └── gap.ts ├── utils │ ├── index.ts │ └── handlers │ │ ├── index.ts │ │ └── regex.ts ├── variants │ ├── children.ts │ ├── directions.ts │ ├── startingstyle.ts │ ├── index.ts │ ├── supports.ts │ ├── dark.ts │ ├── media.ts │ └── important.ts ├── shorthands.ts ├── theme │ ├── preflight.ts │ ├── index.ts │ ├── aria.ts │ ├── filters.ts │ └── transition.ts ├── transformer │ ├── transformerAttributify │ │ ├── index.ts │ │ └── transformer.ts │ └── index.ts └── rpxTranform │ ├── uniapp.ts │ └── index.ts ├── variants.d.ts ├── transformer.d.ts ├── .npmrc ├── test ├── assets │ ├── output │ │ ├── preset-mini-font-weight-theme.css │ │ ├── preset-mini │ │ │ ├── font-weight-theme.css │ │ │ ├── font-size-theme.css │ │ │ ├── dark-class.css │ │ │ ├── nested-theme-colors.css │ │ │ ├── active-pseudo.css │ │ │ ├── non-nested-theme-colors.css │ │ │ ├── empty-prefix.css │ │ │ ├── custom-var-prefix.css │ │ │ ├── dark-customizing-selector.css │ │ │ ├── group-data.css │ │ │ └── targets-2.css │ │ ├── preset-mini、font-weight-theme.css │ │ ├── transformer-class │ │ │ └── base.tsx │ │ ├── transformer-attributify │ │ │ └── base.vue │ │ └── preset-weapp │ │ │ └── targets-2.css │ └── preset-weapp-targets.ts ├── setup.ts ├── __snapshots__ │ └── parser.test.ts.snap ├── debug.test.ts └── wh-rpx.test.ts ├── assets └── Snipaste_2023-06-17_19-53-21.png ├── vitest.config.ts ├── .vscode └── settings.json ├── .gitignore ├── .github └── workflows │ └── release.yml ├── tsconfig.json └── LICENSE /examples/taro4_vite_vue3/src/app.less: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /examples/taro4_webpack5_vue3/src/app.less: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rules.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/rules' 2 | -------------------------------------------------------------------------------- /theme.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/theme' 2 | -------------------------------------------------------------------------------- /utils.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/utils' 2 | -------------------------------------------------------------------------------- /colors.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/colors' 2 | -------------------------------------------------------------------------------- /examples/taro_webpack4_vue3/src/app.css: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/colors.ts: -------------------------------------------------------------------------------- 1 | export * from './theme/colors' 2 | -------------------------------------------------------------------------------- /src/rules.ts: -------------------------------------------------------------------------------- 1 | export * from './rules/index' 2 | -------------------------------------------------------------------------------- /src/theme.ts: -------------------------------------------------------------------------------- 1 | export * from './theme/index' 2 | -------------------------------------------------------------------------------- /src/utils.ts: -------------------------------------------------------------------------------- 1 | export * from './utils/index' 2 | -------------------------------------------------------------------------------- /src/variants.ts: -------------------------------------------------------------------------------- 1 | export * from './variants/index' 2 | -------------------------------------------------------------------------------- /variants.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/variants' 2 | -------------------------------------------------------------------------------- /examples/taro_webpack5_react/src/pages/index/index.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/transformer.ts: -------------------------------------------------------------------------------- 1 | export * from './transformer/index' 2 | -------------------------------------------------------------------------------- /transformer.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/transformer' 2 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | # 使用淘宝镜像 2 | # registry=https://registry.npmmirror.com 3 | -------------------------------------------------------------------------------- /examples/taro4_vite_vue3/.env.test: -------------------------------------------------------------------------------- 1 | # TARO_APP_ID="测试环境下的小程序 AppID" 2 | -------------------------------------------------------------------------------- /examples/uniapp_vue3/.npmrc: -------------------------------------------------------------------------------- 1 | # registry=https://registry.npmmirror.com 2 | -------------------------------------------------------------------------------- /examples/taro4_vite_vue3/.env.production: -------------------------------------------------------------------------------- 1 | # TARO_APP_ID="生产环境下的小程序 AppID" 2 | -------------------------------------------------------------------------------- /examples/taro4_webpack5_vue3/.env.test: -------------------------------------------------------------------------------- 1 | # TARO_APP_ID="测试环境下的小程序 AppID" 2 | -------------------------------------------------------------------------------- /examples/taro4_webpack5_vue3/.env.production: -------------------------------------------------------------------------------- 1 | # TARO_APP_ID="生产环境下的小程序 AppID" 2 | -------------------------------------------------------------------------------- /examples/taro_webpack5_vue3/.npmrc: -------------------------------------------------------------------------------- 1 | # registry=https://registry.npmmirror.com 2 | -------------------------------------------------------------------------------- /src/rules/constant.ts: -------------------------------------------------------------------------------- 1 | export const varEmpty = 'var(--un-empty,/*!*/ /*!*/)' 2 | -------------------------------------------------------------------------------- /examples/uniapp_vue3/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "@unocss" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /examples/taro_webpack4_vue3/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | deploy_versions/ 3 | .temp/ 4 | .rn_temp/ 5 | node_modules/ 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /examples/taro_webpack5_react/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | deploy_versions/ 3 | .temp/ 4 | .rn_temp/ 5 | node_modules/ 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /examples/taro_webpack5_react/src/app.css: -------------------------------------------------------------------------------- 1 | .uno-bg{ 2 | @apply: bg-#e33 text-center my-0 font-medium text-base c-#fff; 3 | } 4 | -------------------------------------------------------------------------------- /examples/taro_webpack5_vue3/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | deploy_versions/ 3 | .temp/ 4 | .rn_temp/ 5 | node_modules/ 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /examples/taro4_vite_vue3/src/pages/index/index.config.ts: -------------------------------------------------------------------------------- 1 | export default definePageConfig({ 2 | navigationBarTitleText: '首页', 3 | }) 4 | -------------------------------------------------------------------------------- /test/assets/output/preset-mini-font-weight-theme.css: -------------------------------------------------------------------------------- 1 | /* layer: default */ 2 | .font-foot{font-weight:100;} 3 | .font-head{font-weight:900;} -------------------------------------------------------------------------------- /test/assets/output/preset-mini/font-weight-theme.css: -------------------------------------------------------------------------------- 1 | /* layer: default */ 2 | .font-foot{font-weight:100;} 3 | .font-head{font-weight:900;} -------------------------------------------------------------------------------- /test/assets/output/preset-mini、font-weight-theme.css: -------------------------------------------------------------------------------- 1 | /* layer: default */ 2 | .font-foot{font-weight:100;} 3 | .font-head{font-weight:900;} -------------------------------------------------------------------------------- /assets/Snipaste_2023-06-17_19-53-21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MellowCo/unocss-preset-weapp/HEAD/assets/Snipaste_2023-06-17_19-53-21.png -------------------------------------------------------------------------------- /examples/taro4_vite_vue3/.env.development: -------------------------------------------------------------------------------- 1 | # 配置文档参考 https://taro-docs.jd.com/docs/next/env-mode-config 2 | # TARO_APP_ID="开发环境下的小程序 AppID" 3 | -------------------------------------------------------------------------------- /examples/taro4_webpack5_vue3/src/pages/index/index.config.ts: -------------------------------------------------------------------------------- 1 | export default definePageConfig({ 2 | navigationBarTitleText: '首页', 3 | }) 4 | -------------------------------------------------------------------------------- /examples/taro_webpack5_react/src/pages/index/index.config.ts: -------------------------------------------------------------------------------- 1 | export default definePageConfig({ 2 | navigationBarTitleText: '首页' 3 | }) 4 | -------------------------------------------------------------------------------- /examples/taro_webpack5_vue3/src/pages/index/index.config.ts: -------------------------------------------------------------------------------- 1 | export default definePageConfig({ 2 | navigationBarTitleText: '首页', 3 | }) 4 | -------------------------------------------------------------------------------- /src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './handlers' 2 | export * from './mappings' 3 | export * from './utilities' 4 | export * from './variants' 5 | -------------------------------------------------------------------------------- /examples/taro4_vite_vue3/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | deploy_versions/ 3 | .temp/ 4 | .rn_temp/ 5 | node_modules/ 6 | .DS_Store 7 | .swc 8 | *.local 9 | -------------------------------------------------------------------------------- /examples/taro4_webpack5_vue3/.env.development: -------------------------------------------------------------------------------- 1 | # 配置文档参考 https://taro-docs.jd.com/docs/next/env-mode-config 2 | # TARO_APP_ID="开发环境下的小程序 AppID" 3 | -------------------------------------------------------------------------------- /examples/taro4_webpack5_vue3/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | deploy_versions/ 3 | .temp/ 4 | .rn_temp/ 5 | node_modules/ 6 | .DS_Store 7 | .swc 8 | *.local 9 | -------------------------------------------------------------------------------- /examples/uniapp_vue2/src/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MellowCo/unocss-preset-weapp/HEAD/examples/uniapp_vue2/src/static/logo.png -------------------------------------------------------------------------------- /examples/uniapp_vue3/src/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MellowCo/unocss-preset-weapp/HEAD/examples/uniapp_vue3/src/static/logo.png -------------------------------------------------------------------------------- /examples/vue2_example/src/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MellowCo/unocss-preset-weapp/HEAD/examples/vue2_example/src/static/logo.png -------------------------------------------------------------------------------- /examples/taro4_vite_vue3/src/pages/bg/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MellowCo/unocss-preset-weapp/HEAD/examples/taro4_vite_vue3/src/pages/bg/logo.png -------------------------------------------------------------------------------- /examples/taro_webpack4_vue3/src/pages/bg/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MellowCo/unocss-preset-weapp/HEAD/examples/taro_webpack4_vue3/src/pages/bg/logo.png -------------------------------------------------------------------------------- /examples/taro_webpack5_vue3/src/app.css: -------------------------------------------------------------------------------- 1 | view, 2 | :before, 3 | :after { 4 | border-width: 0; 5 | border-style: solid; 6 | border-color: #e5e7eb; 7 | } 8 | -------------------------------------------------------------------------------- /examples/taro_webpack5_vue3/src/pages/bg/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MellowCo/unocss-preset-weapp/HEAD/examples/taro_webpack5_vue3/src/pages/bg/logo.png -------------------------------------------------------------------------------- /examples/taro4_webpack5_vue3/src/pages/bg/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MellowCo/unocss-preset-weapp/HEAD/examples/taro4_webpack5_vue3/src/pages/bg/logo.png -------------------------------------------------------------------------------- /examples/taro4_vite_vue3/.eslintrc: -------------------------------------------------------------------------------- 1 | // ESLint 检查 .vue 文件需要单独配置编辑器: 2 | // https://eslint.vuejs.org/user-guide/#editor-integrations 3 | { 4 | "extends": ["taro/vue3"] 5 | } 6 | -------------------------------------------------------------------------------- /examples/taro4_webpack5_vue3/.eslintrc: -------------------------------------------------------------------------------- 1 | // ESLint 检查 .vue 文件需要单独配置编辑器: 2 | // https://eslint.vuejs.org/user-guide/#editor-integrations 3 | { 4 | "extends": ["taro/vue3"] 5 | } 6 | -------------------------------------------------------------------------------- /examples/taro_webpack4_vue3/.eslintrc: -------------------------------------------------------------------------------- 1 | // ESLint 检查 .vue 文件需要单独配置编辑器: 2 | // https://eslint.vuejs.org/user-guide/#editor-integrations 3 | { 4 | "extends": ["taro/vue3"] 5 | } 6 | -------------------------------------------------------------------------------- /examples/taro_webpack5_react/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["taro/react"], 3 | "rules": { 4 | "react/jsx-uses-react": "off", 5 | "react/react-in-jsx-scope": "off" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/taro4_vite_vue3/config/dev.ts: -------------------------------------------------------------------------------- 1 | import type { UserConfigExport } from "@tarojs/cli" 2 | 3 | export default { 4 | 5 | mini: {}, 6 | h5: {} 7 | } satisfies UserConfigExport<'vite'> 8 | -------------------------------------------------------------------------------- /examples/taro_webpack4_vue3/config/dev.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | NODE_ENV: '"development"' 4 | }, 5 | defineConstants: { 6 | }, 7 | mini: {}, 8 | h5: {} 9 | } 10 | -------------------------------------------------------------------------------- /examples/taro_webpack5_react/config/dev.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | NODE_ENV: '"development"' 4 | }, 5 | defineConstants: { 6 | }, 7 | mini: {}, 8 | h5: {} 9 | } 10 | -------------------------------------------------------------------------------- /examples/taro_webpack5_vue3/config/dev.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | NODE_ENV: '"development"', 4 | }, 5 | defineConstants: { 6 | }, 7 | mini: {}, 8 | h5: {}, 9 | } 10 | -------------------------------------------------------------------------------- /examples/uniapp_vue2/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "types": [ 4 | "@dcloudio/types", 5 | "miniprogram-api-typings", 6 | "mini-types" 7 | ] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/vue2_example/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "types": [ 4 | "@dcloudio/types", 5 | "miniprogram-api-typings", 6 | "mini-types" 7 | ] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/vue2_example/vue.config.js: -------------------------------------------------------------------------------- 1 | const UnoCSS = require('unocss/webpack').default 2 | 3 | module.exports = { 4 | configureWebpack: { 5 | plugins: [ 6 | UnoCSS(), 7 | ], 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /test/assets/preset-weapp-targets.ts: -------------------------------------------------------------------------------- 1 | export const presetWeappTargets: string[] = [ 2 | // preset-weapp 3 | 'dark_cl_bg-white', 4 | 'dark_cl_hover_cl_rounded', 5 | 'left-[calc(-1*var(--td-badge-basic-height)+1rpx)]', 6 | ] 7 | -------------------------------------------------------------------------------- /examples/taro_webpack5_react/project.tt.json: -------------------------------------------------------------------------------- 1 | { 2 | "miniprogramRoot": "./", 3 | "projectname": "taro_webpack5_react", 4 | "appid": "testAppId", 5 | "setting": { 6 | "es6": false, 7 | "minified": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/variants/children.ts: -------------------------------------------------------------------------------- 1 | import type { Variant } from '@unocss/core' 2 | import { variantMatcher } from '../utils' 3 | 4 | export const variantChildren: Variant[] = [ 5 | variantMatcher('*', input => ({ selector: `${input.selector} > *` })), 6 | ] 7 | -------------------------------------------------------------------------------- /vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | 3 | export default defineConfig({ 4 | optimizeDeps: { 5 | entries: [], 6 | }, 7 | test: { 8 | isolate: false, 9 | setupFiles: ['./test/setup.ts'], 10 | }, 11 | }) 12 | -------------------------------------------------------------------------------- /test/assets/output/preset-mini/font-size-theme.css: -------------------------------------------------------------------------------- 1 | /* layer: default */ 2 | .text-lg{font-size:3rem;line-height:1.5em;} 3 | .text-medium{font-size:2rem;line-height:1.5em;} 4 | .text-small{font-size:1rem;line-height:1;} 5 | .text-xs{font-size:2rem;line-height:1;} -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": [ 3 | "attributify", 4 | "isolations", 5 | "Postprocessor", 6 | "preflights", 7 | "Smoothings", 8 | "uniapp", 9 | "unocss", 10 | "Weapp", 11 | "whitespaces" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /src/utils/handlers/index.ts: -------------------------------------------------------------------------------- 1 | import { createValueHandler } from '@unocss/rule-utils' 2 | import * as valueHandlers from './handlers' 3 | 4 | export const handler = createValueHandler(valueHandlers) 5 | export const h = handler 6 | 7 | export { valueHandlers } 8 | -------------------------------------------------------------------------------- /examples/taro_webpack4_vue3/src/app.ts: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue' 2 | import 'uno.css' 3 | import './app.css' 4 | 5 | const App = createApp({ 6 | onShow (options) {}, 7 | // 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖 8 | }) 9 | 10 | export default App 11 | -------------------------------------------------------------------------------- /examples/uniapp_vue3/src/main.ts: -------------------------------------------------------------------------------- 1 | import { createSSRApp } from 'vue' 2 | import App from './App.vue' 3 | 4 | import 'uno.css' 5 | 6 | export function createApp() { 7 | const app = createSSRApp(App) 8 | return { 9 | app, 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /examples/vue2_example/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App' 3 | import 'uno.css' 4 | 5 | Vue.config.productionTip = false 6 | 7 | App.mpType = 'app' 8 | 9 | const app = new Vue({ 10 | ...App, 11 | }) 12 | app.$mount() 13 | -------------------------------------------------------------------------------- /examples/taro4_webpack5_vue3/config/dev.ts: -------------------------------------------------------------------------------- 1 | import type { UserConfigExport } from "@tarojs/cli" 2 | 3 | export default { 4 | logger: { 5 | quiet: false, 6 | stats: true 7 | }, 8 | mini: {}, 9 | h5: {} 10 | } satisfies UserConfigExport<'webpack5'> 11 | -------------------------------------------------------------------------------- /src/shorthands.ts: -------------------------------------------------------------------------------- 1 | import { globalKeywords } from './utils' 2 | 3 | export const shorthands = { 4 | position: [ 5 | 'relative', 6 | 'absolute', 7 | 'fixed', 8 | 'sticky', 9 | 'static', 10 | ], 11 | globalKeyword: globalKeywords, 12 | } 13 | -------------------------------------------------------------------------------- /test/assets/output/preset-mini/dark-class.css: -------------------------------------------------------------------------------- 1 | /* layer: default */ 2 | .dark .hello .dark_cl_scope-_lfl__dl_hello_lfr__cl_text-1_sl_2{font-size:8rpx;line-height:16rpx;} 3 | .light [world] .scope-_lfl__lfl_world_lfr__lfr__cl_light_cl_text-1_sl_3{font-size:8rpx;line-height:24rpx;} -------------------------------------------------------------------------------- /examples/uniapp_vue3/src/pages/bg/components/xxClass.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 11 | 12 | -------------------------------------------------------------------------------- /examples/taro4_vite_vue3/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /examples/uniapp_vue2/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App' 3 | // 不再需要导入 uno.css 4 | // import 'uno.css' 5 | 6 | Vue.config.productionTip = false 7 | 8 | App.mpType = 'app' 9 | 10 | const app = new Vue({ 11 | ...App, 12 | }) 13 | app.$mount() 14 | -------------------------------------------------------------------------------- /examples/taro4_webpack5_vue3/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /examples/taro_webpack4_vue3/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /examples/taro_webpack5_react/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /src/theme/preflight.ts: -------------------------------------------------------------------------------- 1 | import { backdropFilterBase, boxShadowsBase, filterBase, ringBase, transformBase } from '../rules' 2 | 3 | export const preflightBase = { 4 | ...transformBase, 5 | ...boxShadowsBase, 6 | ...ringBase, 7 | ...filterBase, 8 | ...backdropFilterBase, 9 | } 10 | -------------------------------------------------------------------------------- /examples/taro_webpack4_vue3/babel.config.js: -------------------------------------------------------------------------------- 1 | // babel-preset-taro 更多选项和默认值: 2 | // https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md 3 | module.exports = { 4 | presets: [ 5 | ['taro', { 6 | framework: 'vue3', 7 | ts: true 8 | }] 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /examples/taro_webpack5_react/babel.config.js: -------------------------------------------------------------------------------- 1 | // babel-preset-taro 更多选项和默认值: 2 | // https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md 3 | module.exports = { 4 | presets: [ 5 | ['taro', { 6 | framework: 'react', 7 | ts: true 8 | }] 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /examples/taro_webpack5_react/src/pages/directives/index.tsx: -------------------------------------------------------------------------------- 1 | import { Button, View } from '@tarojs/components' 2 | 3 | export default function () { 4 | return ( 5 | 6 | 222222 7 |