Giter Club home page Giter Club logo

unocss-preset-extra's Introduction

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

npm Downloads


文档

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


内置规则

size - 同时设置 `width` 和 `height` 样式
<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 }

elevation - Vuetify 海拔样式
  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" />

animated - animate.css 的 Unocss 版本

样式名称

<!-- 动画名称 ( 动画名称可在 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.

unocss-preset-extra's People

Contributors

renovate[bot] avatar zhang-wei-666 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

zzzzzzcc

unocss-preset-extra's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/coverage.yml
  • actions/checkout v4
  • actions/setup-node v4
  • codecov/codecov-action v4
.github/workflows/npm-publish.yml
  • actions/checkout v4
  • actions/setup-node v4
npm
docs/package.json
  • @vueuse/core ^10.7.0
  • @vueuse/head ^2.0.0
  • @vueuse/math ^10.7.0
  • highlight.js ^11.9.0
  • lodash ^4.17.21
  • mixte ^1.11.0
  • naive-ui ^2.35.0
  • pinia ^2.1.7
  • vite-ssg ^0.23.5
  • vue ^3.4.27
  • vue-i18n ^9.13.1
  • vue-router ^4.3.2
  • @css-render/vue3-ssr ^0.15.12
  • @iconify/json ^2.2.157
  • @intlify/unplugin-vue-i18n ^1.6.0
  • @moomfe/eslint-config ^2.7.2
  • @rollup/pluginutils ^5.1.0
  • @types/fs-extra ^11.0.4
  • @types/jsdom ^21.1.6
  • @types/lodash ^4.14.202
  • @types/node ^20.10.4
  • @vitejs/plugin-vue ^4.5.2
  • @vitejs/plugin-vue-jsx ^3.1.0
  • @vue/compiler-sfc ^3.4.27
  • critters ^0.0.20
  • cross-env ^7.0.3
  • eslint ^8.57.0
  • fs-extra ^11.2.0
  • jsdom ^24.0.0
  • pnpm ^9.1.1
  • sass ^1.69.5
  • typescript ^5.3.3
  • unocss ^0.60.0
  • unocss-preset-extra ^0.5.3
  • unocss-preset-scrollbar ^0.3.0
  • unplugin-auto-import ^0.17.2
  • unplugin-icons ^0.18.1
  • unplugin-vue-components ^0.26.0
  • vite ^5.0.9
  • vite-plugin-inspect ^0.8.1
  • vite-plugin-pages ^0.32.0
  • vite-plugin-vue-layouts ^0.9.1
  • vite-ssg-sitemap ^0.6.1
  • pnpm 9.1.1
package.json
  • @moomfe/eslint-config ^2.7.2
  • @types/fs-extra ^11.0.4
  • @types/lodash-es ^4.17.12
  • @types/node ^20.10.4
  • @types/postcss-js ^4.0.4
  • @unocss/autocomplete ^0.58.0
  • @vitest/coverage-v8 ^1.6.0
  • @vitest/ui ^1.6.0
  • animate.css ^4.1.1
  • cssnano ^6.0.2
  • eslint ^8.57.0
  • fast-glob ^3.3.2
  • fs-extra ^11.2.0
  • local-pkg ^0.5.0
  • lodash-es ^4.17.21
  • mixte ^1.11.0
  • pnpm ^9.1.1
  • postcss ^8.4.32
  • postcss-js ^4.0.1
  • rollup ^4.9.0
  • rollup-plugin-dts ^6.1.0
  • tsx ^4.6.2
  • typescript ^5.3.3
  • unocss ^0.60.0
  • vite ^5.0.9
  • vitest ^1.6.0
  • unocss >= 0.31.0 < 1
  • pnpm 9.1.1

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.