UNPKG

unocss-preset-weapp

Version:

the unocss preset for wechat miniprogram (uniapp, taro)

124 lines (121 loc) 3.04 kB
import * as _unocss_core from '@unocss/core'; import { PresetOptions } from '@unocss/core'; export { colors } from './colors.js'; export { t as theme } from './shared/unocss-preset-weapp.Bsu1kvKv.js'; export { p as parseColor } from './shared/unocss-preset-weapp.B0EY9Uts.js'; export { T as Theme, a as ThemeAnimation } from './shared/unocss-preset-weapp.B3KEO0TY.js'; import '@unocss/rule-utils'; interface DarkModeSelectors { /** * Selector for light variant. * * @default '.light' */ light?: string | string[]; /** * Selector for dark variant. * * @default '.dark' */ dark?: string | string[]; } interface PresetWeappOptions extends PresetOptions { /** * Dark mode options * */ dark?: 'class' | 'media' | DarkModeSelectors; /** * @default false */ attributifyPseudo?: boolean; /** * Prefix for CSS variables. * * @default 'un-' */ variablePrefix?: string; /** * Utils prefix * * @default undefined */ prefix?: string | string[]; /** * Generate preflight * * @default true */ preflight?: boolean | 'on-demand'; /** * 是否转换微信class * * @default true */ transform?: boolean; /** * 平台 * @default 'uniapp' */ platform?: 'taro' | 'uniapp'; /** * taro h5 rem 换算尺寸标准 * @default 750 * @link https://taro-docs.jd.com/taro/docs/size */ designWidth?: number; /** * taro 设计稿尺寸换算规则 * @default '{ 640: 2.34 / 2, 750: 1, 828: 1.81 / 2}' * @link https://taro-docs.jd.com/taro/docs/size */ deviceRatio?: Record<number, number>; /** * taro webpack 版本 * taro webpack4 和 webpack5 h5根字体大小,导致不同版本 rem 不一致 * 见下面issues * @link https://github.com/NervJS/taro/issues/12361 * @default webpack4 */ taroWebpack?: 'webpack4' | 'webpack5'; /** * 是否为h5 * @default false */ isH5?: boolean; /** * 自定义转换规则 * @default https://github.com/MellowCo/unplugin-transform-class#options */ transformRules?: Record<string, string>; /** * wh 是否使用 rpx 为默认单位 * @example * ``` * whRpx: true * w-10 -> width: 10rpx * h-10 -> height: 10rpx * ``` * * @example * ``` * whRpx: false * w-10 -> width: 80rpx * h-10 -> height: 80rpx * ``` * @default true */ whRpx?: boolean; /** * Enable arbitrary variants, for example `<div class="[&>*]:m-1 [&[open]]:p-2"></div>`. * * Disable this might slightly improve the performance. * * @default true */ arbitraryVariants?: boolean; } declare const presetWeapp: _unocss_core.PresetFactory<object, PresetWeappOptions>; // @ts-ignore export = presetWeapp; export { type DarkModeSelectors, type PresetWeappOptions, presetWeapp };