npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wot-ui/unocss-preset

v1.0.0

Published

专为 wot-ui 打造的 UnoCSS 预设,提供开箱即用的主题变量映射与原子化类名。

Readme

@wot-ui/unocss-preset

专为 wot-ui 打造的 UnoCSS 预设,内置主题变量、语义色、间距、圆角、字重、透明度、描边和排版相关原子类规则。

这是什么

@wot-ui/unocss-preset 是一个给 UnoCSS 使用的预设包,目标是把 wot-ui 的设计 token 和主题变量映射成可直接使用的原子类。

它主要解决两件事:

| 作用 | 说明 | | --- | --- | | 统一设计 token | 把 wot-ui 里的颜色、间距、圆角、字重、排版、透明度、描边等 token 暴露为统一的 UnoCSS 类名 | | 降低样式接入成本 | 业务项目不需要手写大量 CSS 变量映射,直接使用 wot- 前缀原子类即可完成样式编排 |

接入后,你可以直接在模板里写出类似下面的类名:

<view class="wot-bg-filled-oppo wot-rounded-xl wot-p-loose">
  <text class="wot-text-title-large wot-text-text-main wot-font-semibold">
    Wot UI UnoCSS Preset
  </text>
</view>

适合谁用

  • 已经在项目里使用 UnoCSS
  • 希望直接复用 wot-ui 的设计 token 和主题变量
  • 希望通过原子类快速完成 uni-app / Vue 页面样式搭建

它是怎么工作的

这个预设在运行时主要提供三部分能力:

| 能力 | 说明 | | --- | --- | | theme | 把 wot-ui 语义色和基础色映射到 UnoCSS theme,供颜色类规则使用 | | rules | 生成 wot-text-*wot-bg-*wot-m-*wot-p-*wot-rounded-* 等原子类规则 | | preflights | 自动注入 wot-ui 的 CSS 变量,确保这些原子类能拿到正确的变量值 |

默认情况下,类名前缀是 wot-,例如:

  • wot-text-primary
  • wot-bg-danger-surface
  • wot-m-main
  • wot-rounded-md
  • wot-text-body-main

怎么用

使用方式分三步:

| 步骤 | 说明 | | --- | --- | | 1. 安装依赖 | 安装 unocss@wot-ui/unocss-preset | | 2. 注册 preset | 在 unocss.config.ts 中引入并启用 presetWot() | | 3. 在模板中使用类名 | 直接写 wot- 前缀原子类,不再手动维护大量样式映射 |

安装

pnpm add -D unocss
pnpm add @wot-ui/unocss-preset

使用

import { presetWot } from '@wot-ui/unocss-preset'
import { defineConfig } from 'unocss'

export default defineConfig({
  presets: [
    presetWot(),
  ],
})

配置项

presetWot({
  prefix: 'wot',
  preflight: true,
  baseTokens: false,
})

| 配置项 | 默认值 | 说明 | 示例 | | --- | --- | --- | --- | | prefix | wot | 工具类前缀 | wot-text-primarywot-m-main | | preflight | true | 是否自动注入 wot-ui CSS 变量 | presetWot({ preflight: true }) | | baseTokens | false | 是否开放基础色板和原始 token 类名 | presetWot({ baseTokens: true }) |

提供的规则

| 规则类型 | 前缀模式 | 示例 | | --- | --- | --- | | 颜色 | wot-text-* / wot-bg-* / wot-border-* | wot-text-primarywot-bg-danger-surfacewot-border-border-main | | 间距 | wot-m-* / wot-gap-* | wot-m-mainwot-gap-tightwot-gap-x-loose | | 内边距 | wot-p-* | wot-p-mainwot-px-tightwot-pb-loose | | 圆角 | wot-rounded-* | wot-rounded-mdwot-rounded-full | | 字重 | wot-font-* | wot-font-mediumwot-font-semibold | | 排版 | wot-text-* | wot-text-body-mainwot-text-title-large | | 透明度 | wot-opacity-* | wot-opacity-disabled | | 描边 | wot-border-stroke-* | wot-border-stroke-main |

可用变量值

以下为各类原子类支持的主要变量值,使用时将它们拼接到对应规则后即可。

颜色类

| 项目 | 内容 | | --- | --- | | 适用前缀 | wot-text-*wot-bg-*wot-border-* | | 主色 | primaryprimary-1 ~ primary-10 | | 危险色 | dangerdanger-maindanger-hoverdanger-clickeddanger-disableddanger-particulardanger-surface | | 成功色 | successsuccess-mainsuccess-hoversuccess-clickedsuccess-disabledsuccess-particularsuccess-surface | | 警告色 | warningwarning-mainwarning-hoverwarning-clickedwarning-disabledwarning-particularwarning-surface | | 文字色 | text-maintext-secondarytext-auxiliarytext-disabledtext-placeholdertext-white | | 图标色 | icon-mainicon-secondaryicon-auxiliaryicon-disabledicon-placeholdericon-white | | 边框色 | border-extra-strongborder-strongborder-mainborder-lightborder-whiteborder-zero | | 填充色 | filled-extra-strongfilled-strongfilled-contentfilled-bottomfilled-oppofilled-zero | | 分割线 | divider-maindivider-lightdivider-strongdivider-white | | 反馈色 | feedback-hoverfeedback-activefeedback-accent | | 半透明填充 | opacfilled-tooltip-toast-coveropacfilled-main-coveropacfilled-light-cover | | Picker View Mask | picker-view-mask-startpicker-view-mask-end | | 分类色 | classify-yellow-bgclassify-yellow-borderclassify-yellow-contentclassify-cyan-bgclassify-cyan-borderclassify-cyan-contentclassify-purple-bgclassify-purple-borderclassify-purple-contentclassify-grape-bgclassify-grape-borderclassify-grape-contentclassify-pink-bgclassify-pink-borderclassify-pink-content | | 示例 | wot-text-primarywot-bg-filled-oppowot-border-border-mainwot-bg-classify-purple-content |

间距类

| 项目 | 内容 | | --- | --- | | 适用前缀 | wot-m-*wot-mx-*wot-my-*wot-mt-*wot-mr-*wot-mb-*wot-ml-*wot-gap-*wot-gap-x-*wot-gap-y-* | | 可用值 | zeroultra-tightsuper-tightextra-tighttightmainlooseextra-loosesuper-looseultra-loosespaciousextra-spacioussuper-spaciousultra-spacious | | 示例 | wot-m-mainwot-mt-tightwot-gap-x-loose |

内边距类

| 项目 | 内容 | | --- | --- | | 适用前缀 | wot-p-*wot-px-*wot-py-*wot-pt-*wot-pr-*wot-pb-*wot-pl-* | | 可用值 | zeroultra-tightsuper-tightextra-tighttightmainlooseextra-loosesuper-looseultra-loosespaciousextra-spacioussuper-spaciousultra-spacious | | 示例 | wot-p-mainwot-px-tightwot-pb-loose |

圆角类

| 项目 | 内容 | | --- | --- | | 适用前缀 | wot-rounded-* | | 可用值 | zerosmmdlgxl2xl3xlfull | | 示例 | wot-rounded-mdwot-rounded-full |

字重类

| 项目 | 内容 | | --- | --- | | 适用前缀 | wot-font-* | | 可用值 | ultra-lightthinlightregularmediumsemiboldbold | | 示例 | wot-font-mediumwot-font-semibold |

排版类

| 项目 | 内容 | | --- | --- | | 适用前缀 | wot-text-* | | Title | title-maintitle-largetitle-extra-large | | Body | body-mainbody-largebody-extra-largebody-super-largebody-ultra-large | | Label | label-super-smalllabel-extra-smalllabel-smalllabel-mainlabel-large | | 示例 | wot-text-body-mainwot-text-title-largewot-text-label-large |

透明度类

| 项目 | 内容 | | --- | --- | | 适用前缀 | wot-opacity-* | | 可用值 | disableddimmeroverlaymainbackdrop | | 示例 | wot-opacity-disabledwot-opacity-main |

描边类

| 项目 | 内容 | | --- | --- | | 适用前缀 | wot-border-stroke-* | | 可用值 | zerolightmainbold | | 示例 | wot-border-stroke-mainwot-border-stroke-bold |

baseTokens 开启后可用

baseTokens: true 时,会额外开放基础色板与原始 token。

| 项目 | 内容 | | --- | --- | | 基础色 | base-blackbase-whitebase-transparent | | 色阶家族 | blue-*lightblue-*pink-*red-*volcano-*orange-*yellow-*green-*cyan-*purple-*grape-*coolgrey-*neutralgrey-*warmgrey-* | | 色阶范围 | 每个家族支持 1 ~ 10 | | 额外透明色 | 非 grey 家族额外支持 *-opac | | 透明阶 | opac-1_02opac-2_04opac-3_08opac-4_15opac-5_20opac-6_30opac-7_45opac-7_55opac-8_65opac-9_75opac-10_85 | | 白色透明阶 | opacwhite-1_02opacwhite-2_04opacwhite-3_08opacwhite-4_15opacwhite-5_20opacwhite-6_30opacwhite-7_45opacwhite-7_55opacwhite-8_65opacwhite-9_75opacwhite-10_85 | | 示例 | wot-bg-base-blackwot-text-blue-6wot-border-opac-3_08 |

导出内容

包默认导出 presetWot,并额外导出以下 token maps,便于业务侧复用:

  • SEMANTIC_COLOR_MAP
  • BASE_COLOR_MAP
  • SPACING_MAP
  • PADDING_MAP
  • RADIUS_MAP
  • FONT_WEIGHT_MAP
  • TYPOGRAPHY_MAP
  • OPACITY_MAP
  • STROKE_MAP

开发

pnpm build
pnpm test
pnpm typecheck

License

MIT