2.1.18 • Published 4 months ago

preset-wind-plus v2.1.18

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Features

We like the tailwindcss syntax, but it's often too long to read. Today, with unocss and this preset, you can reduce tailwind syntax by 30% and improve code readability. You need Preset-wind4 and this preset to work Reduce 30% tailwind syntax

Liste des Shortcuts

  • Flexbox
  • Pading / margin
  • margin-inline / pading-inline
  • margin-trim
  • Size
  • inset-x or inset-y
  • flex-grow flex-shrink flex-basis
  • Compress tailwind Line 30%
  • grid area
  • fluide size

Usage

bun i -D       preset-wind-plus unocss @unocss/preset-wind4
// uno.config.ts
import { defineConfig} from "unocss";
import presetWindPlus from 'preset-wind-plus'
import presetWind4 from "@unocss/preset-wind4";
export default defineConfig({
  presets: [
    // ...
    presetWind4(),
    presetWindPlus({
      maxScreenW:1150,
      minScreenW:320,
    }),
  ],
})
// astro.config.ts
import { defineConfig } from 'astro/config'
import UnoCSS from 'unocss/astro'

export default defineConfig({
  integrations: [
    UnoCSS(),
  ],
})
Unocss My presettailwind like or CSS
flex|10|50|500grow-10 shrik-50 basis-500
flex|10|50|500remgrow-10 shrik-50 basis-500rem
flex|10|50grow-10 shrik-50
px-6%-10rempl-6% pr-10rem
px-6-10pl-6 pr-10
mx-6-10ml-6 mr-10
mx-6-6mx-6
gap-6-11gap-y-6 gap-x-11
gap-6vw-11%gap-y-6vw gap-x-11%
inset-x-6-9inset-inline: 6px 9px
inset-x-6%-9vwinset-inline: 6% 9vw
inset-y-6-9inset-block: 1.5rem 2.25rem
m-5-6-9-10
inset-6-9-10inset : 6 9 10;
p-6-4-8-201pt-6 pr-4 pb-8 pl-201 or py-6-8 px-4-201
p-6%-4rem-8vw-201%pt-6% pr-4rem pb-8vw pl-201%
p-6-4py-6 px-4
p-6-4-8
p-6-4-auto-auto
flex-col-4justify-items-start items-center flex flex-col
size-60w-60 h-60
size-min-fitw-min h-fit
size-60-80w-60 h-80
mx-trim | my-trim | mt-trimmargin-trim
grid-area-onegrid-area: one;
grid-area-helloWorldgrid-area: helloWorld;
my-trimmargin-trim: block
mt-trimmargin-trim: block-start;
#### All css sizes supported if they are iside [brackets]
em|rem|%|vw|vh|svh|lvh|svw|lvw|dvw|svi|lvi|dvb => [21svh] [5/7] [1px]

text-[red,hover:orange]
bg-[red,lg:[hover:green-100,green-600],md:pink]
grid-[col-start-1,col-span-2,lg:[col-start-1,col-span-3,row-span-12]]

Compress the length of tailwindcss Class

Merge rules for :

list|col|row|grid|fill|font|text|bg|border|stroke|outline|underline|ring|divide It reqiuere the presetWind() Preset-windto work because it convert to tailwindcss class Preset-wind presset

unocssTailwind convertion
text-[red,hover:orange,md:hover: green,blue,first:green ]text-red hover:text-orange md:hover:text-green md:hover:text-blue md:hover:first:text-green

Flexbox shortcut

flexbox Flexbox Decompose the layout of the divs in a grid from 1 to 9.

flex-row-1 flex-row-2 flex-row-3 flex-row-4 flex-row-5 flex-row-6 flex-row-7 flex-row-8 flex-row-9
flex-col-1 flex-col-2 flex-col-3 flex-col-4 flex-col-5 flex-col-6 flex-col-7 flex-col-8 flex-col-9

unocss to tailwindcss exemple:

flex-col-4 = justify-items-start items-center flex flex-col
<div class="flex-row-2 border-3 size-100 [&>div]:(size-6)">
	<div class="bg-red-200! m-3"></div>
	<div class="bg-red-600 m-3"></div>
	<div class="bg-[#ffff] m-3"></div>
</div>

https://github.com/jojojojojoj5564656465465/unocss-preset-starter/assets/45184918/d43fa35e-5c34-400c-bc0c-110752c96d05

.flex-row-2 {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: start;
}
.flex-col-4 {
  display: flex;
  flex-direction: column;
  justify-content: start;
  align-items: center;
}
.flex-col-7 {
  display: flex;
  flex-direction: column;
  justify-content: start;
  align-items: end;
}

copy and Past

Don't forget to activate the UNOCSS extension with underline

Unocss extension

<div class="flex-row-8 border-[6,red,solid] [&>div]:(size-30 bg-green)  grid-[col-span-1,col-start-2]">
	<div class="bg-red-600  m-3"></div>
	<div class="bg-red-600  m-3"></div>
	<div class="bg-red-600  m-3"></div>
	<div class="bg-red-600! m-3"></div>
	<div class="bg-red-200! m-3"></div>
	<div class="bg-red-600 	m-3"></div>
	<div class="bg-[#ffff] size-10 m-3 md:row-[span-6,start-6] gap-3-9 flex|1|20|50%"></div>
</div>

<div class="grid grid-[rows-3,flow-col] grid-cols-[auto,1fr,10px] gap-4 px-[6rem]-[8em]">
  <div class="row-[start-2,span-2] grid-area-one gap-2-6 px-6-1 inset-x-4 p-[16rem]-16-auto-full">01</div>
  <div class="col-[end-3,span-2] bg-red grid-area-two">02</div>
  <div class="size-9-7">03</div>
  <div class="size-[9%]-[7rem] m-[7%]-[5rem]-screen-auto">09</div>
  <div class="mx-8rem-4 mx-auto mx-10-5 py-[88px]-88 px-px">03</div>
  <div class="inset-x-5-9 inset-y-[50%]-[9rem] bg-[red,lg:[hover:green-100,green-600],md:pink]">03</div>
</div>

fluide size

Fluid Value Shortcuts for UnoCSS

All fluid value shortcuts must follow these rules: 1. They must start with ~ to indicate a fluid value. 2. The minimum and maximum values should be separated by /.

Available Shortcuts

ShortcutDescription
~m-min/maxFluid margin
~mx-min/maxFluid horizontal margin (left and right)
~my-min/maxFluid vertical margin (top and bottom)
~mt-min/maxFluid top margin
~mr-min/maxFluid right margin
~mb-min/maxFluid bottom margin
~ml-min/maxFluid left margin
~p-min/maxFluid padding
~px-min/maxFluid horizontal padding (left and right)
~py-min/maxFluid vertical padding (top and bottom)
~pt-min/maxFluid top padding
~pr-min/maxFluid right padding
~pb-min/maxFluid bottom padding
~pl-min/maxFluid left padding
~text-min/maxFluid font size
~gap-min/maxFluid gap (for grid and flexbox layouts)
~w-min/maxFluid width
~h-min/maxFluid height
~border-min/maxFluid border width
~outline-min/maxFluid outline width

Examples

  • ~m-8/16: Creates a fluid margin that scales from 8px to 16px
  • ~text-14/20: Creates a fluid font size that scales from 14px to 20px
  • ~w-100/200: Creates a fluid width that scales from 100px to 200px

Note: The min and max values in these shortcuts represent pixels. The function will convert these to rem units and create a clamp() function that smoothly transitions between these values based on the viewport width.

This syntax allows for quick and easy creation of fluid, responsive designs without the need for multiple breakpoints or complex media queries.

License

MIT License © 2023

2.0.57-beta.9

8 months ago

2.1.9

7 months ago

2.1.16

4 months ago

2.1.17

4 months ago

2.1.15

4 months ago

2.1.12

4 months ago

2.1.13

4 months ago

2.1.10

4 months ago

2.0.57-beta.17

8 months ago

2.1.18

4 months ago

2.1.2

8 months ago

2.1.1

8 months ago

2.1.3

7 months ago

2.1.6

7 months ago

2.1.8

7 months ago

2.1.7

7 months ago

2.0.57-beta.12

8 months ago

2.1.0

8 months ago

2.0.57-beta.10

8 months ago

2.0.57-beta.3

9 months ago

2.0.57-beta.4

9 months ago

2.0.57-beta.5

9 months ago

2.0.57-beta.6

9 months ago

2.0.57-beta.8

9 months ago

2.0.48

9 months ago

2.0.49

9 months ago

2.0.47

9 months ago

2.0.56

9 months ago

2.0.54

9 months ago

2.0.51

9 months ago

2.0.52

9 months ago

2.0.50

9 months ago

2.0.46

9 months ago

2.0.45

9 months ago

2.0.43

9 months ago

2.0.37

9 months ago

2.0.38

9 months ago

2.0.36

9 months ago

2.0.33

10 months ago

2.0.34

10 months ago

2.0.35-beta.3

9 months ago

2.0.35-beta.1

9 months ago

2.0.39

9 months ago

2.0.42

9 months ago

2.0.40

9 months ago

2.0.41

9 months ago

2.0.31

1 year ago

2.0.29

1 year ago

2.0.28

1 year ago

2.0.27

1 year ago

2.0.25

1 year ago

2.0.15

1 year ago

2.0.16

1 year ago

2.0.13

1 year ago

2.0.14

1 year ago

2.0.11

1 year ago

2.0.12

1 year ago

2.0.9

1 year ago

2.0.10

1 year ago

2.0.19

1 year ago

2.0.18

1 year ago

2.0.22

1 year ago

2.0.20

1 year ago

2.0.16-beta.1

1 year ago

2.0.21

1 year ago

2.0.2

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.6

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.5

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago