24 lines
1.0 KiB
TypeScript
24 lines
1.0 KiB
TypeScript
import presetWeapp from "unocss-preset-weapp"
|
|
import { extractorAttributify, transformerClass } from "unocss-preset-weapp/transformer"
|
|
import { themeColors } from "./src/sheep/config/theme"
|
|
|
|
/** 沿用参考项目的 rpx 原子类与属性转换,布局尺寸统一按 750rpx 设计宽度换算 */
|
|
const { presetWeappAttributify, transformerAttributify } = extractorAttributify()
|
|
|
|
export default {
|
|
presets: [presetWeapp({ whRpx: true }), presetWeappAttributify()],
|
|
transformers: [transformerAttributify(), transformerClass()],
|
|
theme: { colors: themeColors },
|
|
shortcuts: {
|
|
"flex-row-center": "flex items-center justify-center",
|
|
"flex-col-center": "flex flex-col items-center justify-center",
|
|
"focus-ring": "outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",
|
|
},
|
|
preflights: [
|
|
{
|
|
/** CSS 与 UnoCSS 从同一份颜色表取值,避免卡片、键盘与 tm-ui 主题偏离 */
|
|
getCSS: () => `:root, page { ${Object.entries(themeColors).map(([key, color]) => `--pay-${key}: ${color}`).join("; ")} }`,
|
|
},
|
|
],
|
|
}
|