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 🙏

© 2024 – Pkg Stats / Ryan Hefner

unocss-preset-extra

v0.5.3

Published

[UnoCSS](https://github.com/unocss/unocss) 扩展, 提供类名简写及额外一些样式预设

Downloads

2,418

Readme

unocss-preset-extra

UnoCSS 扩展, 提供类名简写及额外一些样式预设

npm Downloads

文档

https://unocss-preset-extra.moomfe.com/

内置规则

<div class="size-auto" />
<div class="size-full" />
<div class="min-size-1/2" />
<div class="min-size-xs" />
<div class="max-size-1" />
<div class="max-size-[1px]" />

这将生成以下 css 代码

.size-auto { width: auto; height: auto }
.size-full { width: 100%; height: 100% }
.min-size-1\/2 { min-width: 50%; min-height: 50% }
.min-size-xs { min-width: 20rem; min-height: 20rem }
.max-size-1 { max-width: 0.25rem; max-height: 0.25rem }
.max-size-\[1px\] { max-width: 1px; max-height: 1px }
  1. 类名 elevation 可简写为 el
  2. 可选的前缀 shadow-
  3. 透明度支持 (el|elevation)-(op|opacity)-(0~100)shadow-(op|opacity)-(0~100) 的方式
<!-- 正常使用 -->
<div class="el-1" />
<div class="elevation-2" />
<div class="shadow-el-3" />
<div class="shadow-elevation-4" />
<!-- 透明度 -->
<div class="el-5 el-op-50" />
<div class="el-6 shadow-op-50" />

Variant GroupAttributify Mode 下使用

<!-- Variant Group -->
<div class="el-(1 op-50)" />
<div class="elevation-(1 op-50)" />
<div class="shadow-elevation-(1 op-50)" />

<!-- Attributify Mode -->
<div el="1 op-50" />
<div elevation="1 op-50" />
<div shadow-elevation="1 op-50" />

样式名称

<!-- 动画名称 ( 动画名称可在 https://animate.style 查阅, 使用时需转为 `kebabCase` 短横线隔开的格式 ) -->
<div class="animated animated-bounce" />
<div class="animated animated-fade-in" />
<div class="animated animated-fade-out" />

<!-- 动画运行次数 -->
<div class="animated animated-bounce animated-infinite" /> <!-- 无限循环 -->
<div class="animated animated-bounce animated-repeat-6" /> <!-- 循环 6 次 -->
<div class="animated animated-bounce animated-repeat-666" /> <!-- 循环 666 次 -->

<!-- 动画延迟 -->
<div class="animated animated-bounce animated-delay-6" /> <!-- 延迟 6 毫秒 -->
<div class="animated animated-bounce animated-delay-6s" /> <!-- 延迟 6 秒 -->
<div class="animated animated-bounce animated-delay-6ms" /> <!-- 延迟 6 毫秒 -->

<!-- 动画周期 -->
<div class="animated animated-bounce animated-faster" /> <!-- 很快 -->
<div class="animated animated-bounce animated-fast" /> <!-- 快 -->
<div class="animated animated-bounce" /> <!-- 不设置, 默认 -->
<div class="animated animated-bounce animated-slow" /> <!-- 慢 -->
<div class="animated animated-bounce animated-slower" /> <!-- 很慢 -->
<div class="animated animated-bounce animated-duration-6" /> <!-- 时长为 6 毫秒 -->
<div class="animated animated-bounce animated-duration-6s" /> <!-- 时长为 6 秒 -->
<div class="animated animated-bounce animated-duration-6ms" /> <!-- 时长为 6 毫秒 -->

Variant GroupAttributify Mode 下使用

<!-- Variant Group -->
<div class="animated-(~ bounce infinite)" />
<div class="animated-(~ bounce faster delay-6s)" />

<!-- Attributify Mode -->
<div animated="~ bounce infinite" />
<div animated="~ bounce faster delay-6s" />

在 Vue 3 中使用

<Transition class="animated animated-faster" enter-active-class="animated-rotate-in" leave-active-class="animated-rotate-out" mode="out-in">
  ...
</Transition>

可在 Variant GroupAttributify Mode 下使用

<!-- 使用之前 -->
<div class="flex-(~ col none) justify-center" />
<div class="justify-center" flex="~ col none" />
<!-- 使用之后 -->
<div class="flex-(~ col none justify-center)" />
<div flex="~ col none justify-center" />

<!-- ↓↓↓ 以下是所有规则 ↓↓↓ -->

<!-- (inline-)?(flex|grid)-justify-* -->
<div class="flex-(~ justify-start)" />
<div class="grid-(~ justify-center)" />
<div class="inline-flex-(~ justify-between)" />
<div class="inline-grid-(~ justify-end)" />

<!-- (inline-)?(flex|grid)-order-* -->
<div class="flex-(~ order-first)" />
<div class="grid-(~ order-1)" />
<div class="inline-flex-(~ order-2)" />
<div class="inline-grid-(~ order-last)" />

<!-- (inline-)?(flex|grid)-content-* -->
<div class="flex-(~ content-start)" />
<div class="grid-(~ content-center)" />
<div class="inline-flex-(~ content-between)" />
<div class="inline-grid-(~ content-end)" />

<!-- (inline-)?(flex|grid)-items-* -->
<div class="flex-(~ items-start)" />
<div class="grid-(~ items-center)" />
<div class="inline-flex-(~ items-baseline)" />
<div class="inline-grid-(~ items-end)" />

<!-- (inline-)?(flex|grid)-self-* -->
<div class="flex-(~ self-start)" />
<div class="grid-(~ self-center)" />
<div class="inline-flex-(~ self-baseline)" />
<div class="inline-grid-(~ self-end)" />

<!-- (inline-)?(flex|grid)-place-content-* -->
<div class="flex-(~ place-content-start)" />
<div class="grid-(~ place-content-center)" />
<div class="inline-flex-(~ place-content-between)" />
<div class="inline-grid-(~ place-content-end)" />

<!-- (inline-)?(flex|grid)-place-items-* -->
<div class="flex-(~ place-items-start)" />
<div class="grid-(~ place-items-center)" />
<div class="inline-flex-(~ place-items-stretch)" />
<div class="inline-grid-(~ place-items-end)" />

<!-- (inline-)?(flex|grid)-place-self-* -->
<div class="flex-(~ place-self-start)" />
<div class="grid-(~ place-self-center)" />
<div class="inline-flex-(~ place-self-stretch)" />
<div class="inline-grid-(~ place-self-end)" />

安装

npm install unocss-preset-extra -D

使用

// unocss.config.ts
import { defineConfig, presetAttributify, presetUno } from 'unocss';
import { presetExtra } from 'unocss-preset-extra';

export default defineConfig({
  presets: [
    presetUno(),
    presetAttributify(),
    presetExtra(),
  ],
});

License

unocss-preset-extra is licensed under a MIT License.