Skip to content

Commit be917a6

Browse files
committed
Now supports negative values.
1 parent 31a9892 commit be917a6

File tree

3 files changed

+70
-9
lines changed

3 files changed

+70
-9
lines changed

README.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
Tailwind CSS plugin, add animation-delay CSS property.
44

5+
> [!NOTE]
6+
> Version 2.0.0 now supports negative values.
7+
58
## Installation
69

710
Install the plugin from npm:
@@ -67,6 +70,31 @@ module.exports = {
6770
| animation-delay-7000 | animation-delay: 7000ms; |
6871
| animation-delay-8000 | animation-delay: 8000ms; |
6972
| animation-delay-9000 | animation-delay: 9000ms; |
73+
| -animation-delay-75 | animation-delay: -75ms; |
74+
| -animation-delay-100 | animation-delay: -100ms; |
75+
| -animation-delay-150 | animation-delay: -150ms; |
76+
| -animation-delay-200 | animation-delay: -200ms; |
77+
| -animation-delay-300 | animation-delay: -300ms; |
78+
| -animation-delay-400 | animation-delay: -400ms; |
79+
| -animation-delay-500 | animation-delay: -500ms; |
80+
| -animation-delay-600 | animation-delay: -600ms; |
81+
| -animation-delay-700 | animation-delay: -700ms; |
82+
| -animation-delay-800 | animation-delay: -800ms; |
83+
| -animation-delay-900 | animation-delay: -900ms; |
84+
| -animation-delay-1000 | animation-delay: -1000ms; |
85+
| -animation-delay-1100 | animation-delay: -1100ms; |
86+
| -animation-delay-1200 | animation-delay: -1200ms; |
87+
| -animation-delay-1300 | animation-delay: -1300ms; |
88+
| -animation-delay-1400 | animation-delay: -1400ms; |
89+
| -animation-delay-1500 | animation-delay: -1500ms; |
90+
| -animation-delay-2000 | animation-delay: -2000ms; |
91+
| -animation-delay-3000 | animation-delay: -3000ms; |
92+
| -animation-delay-4000 | animation-delay: -4000ms; |
93+
| -animation-delay-5000 | animation-delay: -5000ms; |
94+
| -animation-delay-6000 | animation-delay: -6000ms; |
95+
| -animation-delay-7000 | animation-delay: -7000ms; |
96+
| -animation-delay-8000 | animation-delay: -8000ms; |
97+
| -animation-delay-9000 | animation-delay: -9000ms; |
7098

7199
## Configuration
72100

@@ -81,10 +109,12 @@ module.exports = {
81109
200: "200ms",
82110
300: "300ms",
83111
400: "400ms",
112+
"-3000": "-3000ms",
113+
"-7000": "-7000ms",
84114
},
85115
},
86116
variants: {
87-
animationDelay: ["responsive", "hover"],
117+
animationDelay: ["focus"],
88118
},
89119
}
90120
```
@@ -103,6 +133,8 @@ module.exports = {
103133
250: "250ms",
104134
350: "350ms",
105135
450: "450ms",
136+
"-3500": "-3500ms",
137+
"-7500": "-7500ms",
106138
},
107139
},
108140
},

index.js

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const plugin = require('tailwindcss/plugin');
22

3-
const animationDelay = plugin(function ({ addUtilities, theme, e }) {
3+
const animationDelay = plugin(function ({ matchUtilities, theme, e }) {
44
const defaultValues = {
55
'none': '0s',
66
75: '75ms',
@@ -28,16 +28,45 @@ const animationDelay = plugin(function ({ addUtilities, theme, e }) {
2828
7000: '7000ms',
2929
8000: '8000ms',
3030
9000: '9000ms',
31+
'-75': '-75ms',
32+
'-100': '-100ms',
33+
'-150': '-150ms',
34+
'-200': '-200ms',
35+
'-300': '-300ms',
36+
'-400': '-400ms',
37+
'-500': '-500ms',
38+
'-600': '-600ms',
39+
'-700': '-700ms',
40+
'-800': '-800ms',
41+
'-900': '-900ms',
42+
'-1000': '-1000ms',
43+
'-1100': '-1100ms',
44+
'-1200': '-1200ms',
45+
'-1300': '-1300ms',
46+
'-1400': '-1400ms',
47+
'-1500': '-1500ms',
48+
'-2000': '-2000ms',
49+
'-3000': '-3000ms',
50+
'-4000': '-4000ms',
51+
'-5000': '-5000ms',
52+
'-6000': '-6000ms',
53+
'-7000': '-7000ms',
54+
'-8000': '-8000ms',
55+
'-9000': '-9000ms',
3156
};
3257

3358
const userValues = theme('animationDelay');
3459
const values = { ...defaultValues, ...userValues };
3560

36-
const utilities = Object.entries(values).map(([key, value]) => ({
37-
[`.${e(`animation-delay-${key}`)}`]: { animationDelay: `${value}` },
38-
}));
39-
40-
addUtilities(utilities);
61+
matchUtilities({
62+
'animation-delay': (value) => ({
63+
animationDelay: value,
64+
}),
65+
}, {
66+
values,
67+
variants: ["responsive", "hover"],
68+
supportsNegativeValues: true,
69+
});
4170
});
4271

43-
module.exports = animationDelay;
72+
module.exports = animationDelay;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tailwindcss-animation-delay",
3-
"version": "1.2.0",
3+
"version": "2.0.0",
44
"description": "Tailwind CSS plugin, add animation-delay CSS property.",
55
"main": "index.js",
66
"license": "MIT",

0 commit comments

Comments
 (0)