This is a summary version that summarizes the improvements and added features from v3.0.6 to v3.1.0.
Color and transparency are usually a common combination. We used to have text-green-500 text-opacity-50. Now you can use the following abbreviations.
text-green-500/50underline-green-500/50placeholder-green-500/50bg-indigo-500/$primary-opacitybg-green-500/[0.17]The new border side color utilities allow you to set different border-color for different sides
border-t-green-200border-t-green-200/50border-b-green-200border-l-yellow-300border-r-blue-400The content utilities generate the corresponding content css, such as content: '', which can be very helpful in many cases.
content-👍before:content-["👍"]content-open-quoteafter:content-[attr(value)]contentCreating gradient colors has always been a hassle, and you can't be sure that the resulting gradient color will look good. So we've added more gradient color defaults to make it easier for users to use. The gradient colors from coolhue.
bg-gradient-1bg-gradient-2bg-gradient-60The previous animation utilities had no interactivity at all, so we added a new set of animations (thanks to the hard work of animate.css) and added the corresponding operation utilities.
animate-noneanimate-spinanimate-pinganimate-pulseanimate-bounceanimate-shockanimate-flashanimate-bubbleanimate-rubber-bandanimate-shake-xanimate-shake-yanimatedYou need to use animated to trigger the animation(animated animate-flash), just like you do with filter blur-sm. If you need the animation to play infinite, you also need to use an animate-loop. This for getting better customizability. Most of the time we probably need just trigger it once, not a loop.
animate-spin animate-ping animate-pulse animate-bounce are special cases, you can trigger them without using animated and they will loop at the same time. Since these are previously existing utilities, suddenly modifying them may cause a lot of trouble for users. You can understand how they work through the configuration file.
export default {
animation: {
'spin': 'spin 1s linear infinite',
'ping': 'ping 1s cubic-bezier(0, 0, 0.2, 1) infinite',
'pulse': 'pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite',
'bounce': 'bounce 1s infinite',
'shock': {
animation: 'shock',
transformOrigin: 'center bottom',
},
'flash': 'flash',
'bubble': 'bubble',
'rubber-band': 'rubberBand',
'shake-x': 'shakeX',
// ...
},
}
The animation-delay utility specifies a delay for the start of an animation.
animate-delay-100animate-delay-1500animate-delay-[1s]animate-delay-$time-delayanimate-delay-1.5sanimate-delay-200msThe animation-direction utility defines whether an animation should be played forwards, backward or in alternate cycles.
animate-reverseanimate-alternateanimate-alternate-reverseThe animation-duration utility defines how long an animation should take to complete one cycle.
animate-duration-100animate-duration-1500animate-duration-1.5sanimate-duration-[1.3s]animate-duration-$time-durationThe animation-fill-mode utility specifies a style for the element when the animation is not playing (before it starts, after it ends, or both).
animate-fill-noneanimate-fill-forwardsanimate-fill-backwardsanimate-fill-bothThe animation-iteration-count utility specifies the number of times an animation should be played.
animate-loopanimate-repeat-1animate-repeat-12animate-repeat-[23]The animation-play-state utility specifies whether the animation is running or paused.
animate-pausedanimate-runningThe animation-timing-function specifies the speed curve of an animation.
animate-easeanimate-ease-inanimate-ease-linearanimate-ease-outanimate-ease-in-outanimate-ease-[cubic-bezier(0.25,0.1,0.25,1)]We also added a new time handler, which allows you to use the corresponding time, like s and ms, directly in the className. duration-{time} delay-{time} animate-duration-{time} animate-delay-{time}.
<div class="duration-1.5s delay-200ms animate-duration-1.3s">...</div>
You can control its switch by configuring handlers.time
export default {
theme: {
// ...
},
handlers: {
static: true,
time: false,
},
}
We added a nice dark mode for the typography plugin, you can enable the feature via the dark configuration, which will add the corresponding dark mode css based on your darkMode configuration.
import typography from 'windicss/plugin/typography'
import { defineConfig } from 'windicss/helpers'
export default defineConfig({
darkMode: 'class',
plugins: [
typography({
dark: true,
}),
],
})
Previously, typography did not support rtl very well, we solved this problem.
import typography from 'windicss/plugin/typography'
import { defineConfig } from 'windicss/helpers'
export default defineConfig({
plugins: [
typography({
rtl: true,
}),
],
})
Added an icon library for windicss, powered by css.gg.
npm install --save-dev @windicss/plugin-icons
Let's simply create a close button or menu. It is completely pure css and is generated on demand.
<div class="bg-gray-200 text-gray-800 hover:bg-gray-300 rounded-full w-8 h-8 flex items-center justify-center">
<i class="icon-close"></i>
</div>
<div class="bg-gray-200 text-gray-800 hover:bg-gray-300 rounded w-12 h-12 flex items-center justify-center">
<i class="icon-menu"></i>
</div>
Processor.test('bg-red-500') // -> boolean
Processor.validate('font-bold text-green-300 sm:dark:hover:text-lg') // -> boolean
addDynamic API addDynamic('line-clamp', ({ Utility, Property, Style }) => {
// ...
}, {
group: 'lineClamp',
completions: [
'line-clamp-none',
'line-clamp-{int}',
],
})