tw-animations-plugin 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +37 -0
  2. package/package.json +47 -0
  3. package/src/index.js +426 -0
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # tw-animations-plugin
2
+
3
+ Extended animation utilities plugin for **Tailwind CSS v3**.
4
+
5
+ > **Note:** This package is for Tailwind CSS v3. If you're using Tailwind CSS v4, use [`tw-animations`](../tailwindcss-animate) instead.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install tw-animations-plugin
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Add the plugin to your Tailwind CSS configuration:
16
+
17
+ ```javascript
18
+ // tailwind.config.js
19
+ module.exports = {
20
+ plugins: [require("tw-animations-plugin")],
21
+ };
22
+ ```
23
+
24
+ ## Features
25
+
26
+ - 85+ animation utilities
27
+ - Scroll animations and view timelines (requires browser support)
28
+ - Animation control utilities (duration, delay, timing, etc.)
29
+ - Arbitrary value support
30
+
31
+ ## Documentation
32
+
33
+ For full documentation, visit [tailwindcss-animate.vercel.app](https://tailwindcss-animate.vercel.app)
34
+
35
+ ## License
36
+
37
+ MIT
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "tw-animations-plugin",
3
+ "version": "2.0.0",
4
+ "description": "Extended animation utilities for Tailwind CSS v3",
5
+ "main": "src/index.js",
6
+ "exports": {
7
+ ".": "./src/index.js",
8
+ "./package.json": "./package.json"
9
+ },
10
+ "scripts": {
11
+ "test": "jest"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/alckordev/tw-animations.git",
16
+ "directory": "packages/tailwindcss-animate-plugin"
17
+ },
18
+ "keywords": [
19
+ "tailwindcss",
20
+ "tailwindcss-v3",
21
+ "tailwindcss-plugin",
22
+ "css-animations",
23
+ "keyframes",
24
+ "animate",
25
+ "transitions",
26
+ "utilities"
27
+ ],
28
+ "files": [
29
+ "/src",
30
+ "/README.md",
31
+ "/LICENSE.md"
32
+ ],
33
+ "author": "Francisco Luis Rios Vega <alckordev@gmail.com>",
34
+ "license": "MIT",
35
+ "bugs": {
36
+ "url": "https://github.com/alckordev/tw-animations/issues"
37
+ },
38
+ "homepage": "https://tailwindcss-animate.vercel.app",
39
+ "peerDependencies": {
40
+ "tailwindcss": "^3.0.0"
41
+ },
42
+ "devDependencies": {
43
+ "jest": "^30.1.2",
44
+ "postcss": "^8.5.1",
45
+ "tailwindcss": "^3.4.17"
46
+ }
47
+ }
package/src/index.js ADDED
@@ -0,0 +1,426 @@
1
+ const plugin = require("tailwindcss/plugin");
2
+
3
+ module.exports = plugin(
4
+ function ({ addUtilities, matchUtilities, theme }) {
5
+ // Animation keyframes
6
+ const animations = {
7
+ // Attention Seekers
8
+ ".animate-flash": { animation: "flash 1s ease 0s both" },
9
+ ".animate-head-shake": { animation: "head-shake 1s ease-in-out 0s both" },
10
+ ".animate-heartbeat": {
11
+ animation: "heartbeat 0.6s ease-out 0s both",
12
+ },
13
+ ".animate-jelly": {
14
+ animation: "jelly 1s ease 0s both",
15
+ transformOrigin: "center",
16
+ },
17
+ ".animate-rubber-band": { animation: "rubber-band 1s ease 0s both" },
18
+ ".animate-shake-x": { animation: "shake-x 1s ease 0s both" },
19
+ ".animate-shake-y": { animation: "shake-y 1s ease 0s both" },
20
+ ".animate-swing": {
21
+ animation: "swing 1s ease 0s both",
22
+ transformOrigin: "top center",
23
+ },
24
+ ".animate-tada": { animation: "tada 1s ease 0s both" },
25
+ ".animate-wiggle": { animation: "wiggle 1s ease 0s both" },
26
+ ".animate-wobble": { animation: "wobble 1s ease 0s both" },
27
+ ".animate-float": { animation: "float 3s ease-in-out 0s infinite" },
28
+
29
+ // New in v2.0
30
+ ".animate-blurred-fade-in": {
31
+ animation: "blurred-fade-in 0.9s ease-in-out 0s both",
32
+ },
33
+ ".animate-blink": { animation: "blink 1s step-end 0s both" },
34
+ ".animate-dancing": { animation: "dancing 1s ease-in-out 0s both" },
35
+ ".animate-impulse-rotation-left": {
36
+ animation: "impulse-rotation-left 1s ease-in-out 0s both",
37
+ },
38
+ ".animate-impulse-rotation-right": {
39
+ animation: "impulse-rotation-right 1s ease-in-out 0s both",
40
+ },
41
+ ".animate-jiggle": { animation: "jiggle 0.6s ease 0s both" },
42
+ ".animate-pop": {
43
+ animation: "pop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0s both",
44
+ },
45
+ ".animate-rotate-360": { animation: "rotate-360 1s ease 0s both" },
46
+ ".animate-rotate-180": { animation: "rotate-180 0.5s ease 0s both" },
47
+ ".animate-rotate-90": { animation: "rotate-90 0.3s ease 0s both" },
48
+
49
+ // Default Tailwind animations
50
+ ".animate-spin": { animation: "spin 1s linear infinite" },
51
+ ".animate-ping": {
52
+ animation: "ping 1s cubic-bezier(0, 0, 0.2, 1) infinite",
53
+ },
54
+ ".animate-pulse": {
55
+ animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
56
+ },
57
+ ".animate-bounce": { animation: "bounce 1s ease infinite" },
58
+
59
+ // Back Entrances
60
+ ".animate-back-in-down": { animation: "back-in-down 1s ease 0s both" },
61
+ ".animate-back-in-start": { animation: "back-in-start 1s ease 0s both" },
62
+ ".animate-back-in-end": { animation: "back-in-end 1s ease 0s both" },
63
+ ".animate-back-in-up": { animation: "back-in-up 1s ease 0s both" },
64
+
65
+ // Back Exits
66
+ ".animate-back-out-down": { animation: "back-out-down 1s ease 0s both" },
67
+ ".animate-back-out-start": {
68
+ animation: "back-out-start 1s ease 0s both",
69
+ },
70
+ ".animate-back-out-end": { animation: "back-out-end 1s ease 0s both" },
71
+ ".animate-back-out-up": { animation: "back-out-up 1s ease 0s both" },
72
+
73
+ // Bouncing Entrances
74
+ ".animate-bounce-in": { animation: "bounce-in 0.75s ease 0s both" },
75
+ ".animate-bounce-in-down": {
76
+ animation: "bounce-in-down 1s ease 0s both",
77
+ },
78
+ ".animate-bounce-in-start": {
79
+ animation: "bounce-in-start 1s ease 0s both",
80
+ },
81
+ ".animate-bounce-in-end": { animation: "bounce-in-end 1s ease 0s both" },
82
+ ".animate-bounce-in-up": { animation: "bounce-in-up 1s ease 0s both" },
83
+
84
+ // Bouncing Exits
85
+ ".animate-bounce-out": { animation: "bounce-out 0.75s ease 0s both" },
86
+ ".animate-bounce-out-down": {
87
+ animation: "bounce-out-down 1s ease 0s both",
88
+ },
89
+ ".animate-bounce-out-start": {
90
+ animation: "bounce-out-start 1s ease 0s both",
91
+ },
92
+ ".animate-bounce-out-end": {
93
+ animation: "bounce-out-end 1s ease 0s both",
94
+ },
95
+ ".animate-bounce-out-up": { animation: "bounce-out-up 1s ease 0s both" },
96
+
97
+ // Dashing
98
+ ".animate-dash-in-start": {
99
+ animation: "dash-in-start 0.5s ease 0s both",
100
+ },
101
+ ".animate-dash-in-end": { animation: "dash-in-end 0.5s ease 0s both" },
102
+ ".animate-dash-out-start": {
103
+ animation: "dash-out-start 0.5s ease 0s both",
104
+ },
105
+ ".animate-dash-out-end": { animation: "dash-out-end 0.5s ease 0s both" },
106
+
107
+ // Expanding
108
+ ".animate-expand-horizontally": {
109
+ animation: "expand-horizontally 1s ease 0s both",
110
+ transformOrigin: "left",
111
+ },
112
+ ".animate-expand-vertically": {
113
+ animation: "expand-vertically 1s ease 0s both",
114
+ transformOrigin: "top",
115
+ },
116
+ ".animate-contract-horizontally": {
117
+ animation: "contract-horizontally 1s ease 0s both",
118
+ transformOrigin: "left",
119
+ },
120
+ ".animate-contract-vertically": {
121
+ animation: "contract-vertically 1s ease 0s both",
122
+ transformOrigin: "top",
123
+ },
124
+ ".animate-bounce-fade-in": {
125
+ animation: "bounce-fade-in 1s ease 0s both",
126
+ },
127
+ ".animate-pulse-fade-in": { animation: "pulse-fade-in 1s ease 0s both" },
128
+ ".animate-slide-up-fade": {
129
+ animation: "slide-up-fade 0.6s ease 0s both",
130
+ },
131
+
132
+ // Fading Entrances (match TW4: 0.6s ease-in)
133
+ ".animate-fade-in": { animation: "fade-in 0.6s ease-in 0s both" },
134
+ ".animate-fade-in-down": {
135
+ animation: "fade-in-down 0.6s ease-in-out 0s both",
136
+ },
137
+ ".animate-fade-in-start": {
138
+ animation: "fade-in-start 0.6s ease-in-out 0s both",
139
+ },
140
+ ".animate-fade-in-end": {
141
+ animation: "fade-in-end 0.6s ease-in-out 0s both",
142
+ },
143
+ ".animate-fade-in-up": {
144
+ animation: "fade-in-up 0.6s ease-in-out 0s both",
145
+ },
146
+
147
+ // Fading Exits (match TW4: 0.6s ease-out)
148
+ ".animate-fade-out": { animation: "fade-out 0.6s ease-out 0s both" },
149
+ ".animate-fade-out-down": {
150
+ animation: "fade-out-down 0.6s ease-out 0s both",
151
+ },
152
+ ".animate-fade-out-start": {
153
+ animation: "fade-out-start 0.6s ease-out 0s both",
154
+ },
155
+ ".animate-fade-out-end": {
156
+ animation: "fade-out-end 0.6s ease-out 0s both",
157
+ },
158
+ ".animate-fade-out-up": {
159
+ animation: "fade-out-up 0.6s ease-out 0s both",
160
+ },
161
+
162
+ // Flippers
163
+ ".animate-flip": {
164
+ animation: "flip 1s ease 0s both",
165
+ backfaceVisibility: "visible",
166
+ },
167
+ ".animate-flip-in-x": {
168
+ animation: "flip-in-x 0.75s ease 0s both",
169
+ backfaceVisibility: "visible",
170
+ },
171
+ ".animate-flip-in-y": {
172
+ animation: "flip-in-y 0.75s ease 0s both",
173
+ backfaceVisibility: "visible",
174
+ },
175
+ ".animate-flip-out-x": {
176
+ animation: "flip-out-x 0.75s ease 0s both",
177
+ backfaceVisibility: "visible",
178
+ },
179
+ ".animate-flip-out-y": {
180
+ animation: "flip-out-y 0.75s ease 0s both",
181
+ backfaceVisibility: "visible",
182
+ },
183
+
184
+ // Rotating Entrances
185
+ ".animate-rotate-in": {
186
+ animation: "rotate-in 1s ease 0s both",
187
+ transformOrigin: "center",
188
+ },
189
+ ".animate-rotate-in-down-start": {
190
+ animation: "rotate-in-down-start 1s ease 0s both",
191
+ transformOrigin: "left bottom",
192
+ },
193
+ ".animate-rotate-in-down-end": {
194
+ animation: "rotate-in-down-end 1s ease 0s both",
195
+ transformOrigin: "right bottom",
196
+ },
197
+ ".animate-rotate-in-up-start": {
198
+ animation: "rotate-in-up-start 1s ease 0s both",
199
+ transformOrigin: "left bottom",
200
+ },
201
+ ".animate-rotate-in-up-end": {
202
+ animation: "rotate-in-up-end 1s ease 0s both",
203
+ transformOrigin: "right bottom",
204
+ },
205
+
206
+ // Rotating Exits
207
+ ".animate-rotate-out": {
208
+ animation: "rotate-out 1s ease 0s both",
209
+ transformOrigin: "center",
210
+ },
211
+ ".animate-rotate-out-down-start": {
212
+ animation: "rotate-out-down-start 1s ease 0s both",
213
+ transformOrigin: "left bottom",
214
+ },
215
+ ".animate-rotate-out-down-end": {
216
+ animation: "rotate-out-down-end 1s ease 0s both",
217
+ transformOrigin: "right bottom",
218
+ },
219
+ ".animate-rotate-out-up-start": {
220
+ animation: "rotate-out-up-start 1s ease 0s both",
221
+ transformOrigin: "left bottom",
222
+ },
223
+ ".animate-rotate-out-up-end": {
224
+ animation: "rotate-out-up-end 1s ease 0s both",
225
+ transformOrigin: "right bottom",
226
+ },
227
+
228
+ // Sliding Entrances
229
+ ".animate-slide-in-down": {
230
+ animation: "slide-in-down 0.6s ease-in-out 0s both",
231
+ },
232
+ ".animate-slide-in-start": {
233
+ animation: "slide-in-start 0.6s ease-in-out 0s both",
234
+ },
235
+ ".animate-slide-in-end": {
236
+ animation: "slide-in-end 0.6s ease-in-out 0s both",
237
+ },
238
+ ".animate-slide-in-up": {
239
+ animation: "slide-in-up 0.6s ease-in-out 0s both",
240
+ },
241
+
242
+ // Sliding Exits
243
+ ".animate-slide-out-down": {
244
+ animation: "slide-out-down 0.6s ease-out 0s both",
245
+ },
246
+ ".animate-slide-out-start": {
247
+ animation: "slide-out-start 0.6s ease-out 0s both",
248
+ },
249
+ ".animate-slide-out-end": {
250
+ animation: "slide-out-end 0.6s ease-out 0s both",
251
+ },
252
+ ".animate-slide-out-up": {
253
+ animation: "slide-out-up 0.6s ease-out 0s both",
254
+ },
255
+
256
+ // Specials
257
+ ".animate-hinge": {
258
+ animation: "hinge 2s ease 0s both",
259
+ transformOrigin: "top left",
260
+ },
261
+ ".animate-jack-in": { animation: "jack-in 1s ease 0s both" },
262
+ ".animate-jack-out": { animation: "jack-out 1s ease 0s both" },
263
+ ".animate-roll-in": { animation: "roll-in 1s ease 0s both" },
264
+ ".animate-roll-out": { animation: "roll-out 1s ease 0s both" },
265
+ ".animate-particle": { animation: "particle 1s ease 0s both" },
266
+
267
+ // Zooming Entrances
268
+ ".animate-zoom-in": { animation: "zoom-in 1s ease 0s both" },
269
+ ".animate-zoom-in-down": { animation: "zoom-in-down 1s ease 0s both" },
270
+ ".animate-zoom-in-start": { animation: "zoom-in-start 1s ease 0s both" },
271
+ ".animate-zoom-in-end": { animation: "zoom-in-end 1s ease 0s both" },
272
+ ".animate-zoom-in-up": { animation: "zoom-in-up 1s ease 0s both" },
273
+
274
+ // Zooming Exits
275
+ ".animate-zoom-out": { animation: "zoom-out 1s ease 0s both" },
276
+ ".animate-zoom-out-down": { animation: "zoom-out-down 1s ease 0s both" },
277
+ ".animate-zoom-out-start": {
278
+ animation: "zoom-out-start 1s ease 0s both",
279
+ },
280
+ ".animate-zoom-out-end": { animation: "zoom-out-end 1s ease 0s both" },
281
+ ".animate-zoom-out-up": { animation: "zoom-out-up 1s ease 0s both" },
282
+ };
283
+
284
+ addUtilities(animations);
285
+
286
+ // Scroll Animations - View Timelines (v2.0)
287
+ addUtilities({
288
+ ".timeline-view": { animationTimeline: "view()" },
289
+ ".timeline-view-x": { animationTimeline: "view(x)" },
290
+ ".timeline-view-y": { animationTimeline: "view(y)" },
291
+ ".timeline-view-block": { animationTimeline: "view(block)" },
292
+ ".timeline-view-inline": { animationTimeline: "view(inline)" },
293
+ ".timeline-scroll": { animationTimeline: "scroll()" },
294
+ ".timeline-scroll-x": { animationTimeline: "scroll(x)" },
295
+ ".timeline-scroll-y": { animationTimeline: "scroll(y)" },
296
+ ".timeline-scroll-block": { animationTimeline: "scroll(block)" },
297
+ ".timeline-scroll-inline": { animationTimeline: "scroll(inline)" },
298
+ });
299
+
300
+ // Animation Ranges (v2.0)
301
+ addUtilities({
302
+ ".animate-range-normal": { animationRange: "normal" },
303
+ ".animate-range-cover": { animationRange: "cover" },
304
+ ".animate-range-contain": { animationRange: "contain" },
305
+ ".animate-range-entry": { animationRange: "entry" },
306
+ ".animate-range-exit": { animationRange: "exit" },
307
+ ".animate-range-entry-crossing": { animationRange: "entry-crossing" },
308
+ ".animate-range-exit-crossing": { animationRange: "exit-crossing" },
309
+ ".animate-range-gradual": { animationRange: "10% 90%" },
310
+ ".animate-range-moderate": { animationRange: "20% 80%" },
311
+ ".animate-range-brisk": { animationRange: "30% 70%" },
312
+ ".animate-range-rapid": { animationRange: "40% 60%" },
313
+ ".animate-range-entry-start": { animationRange: "entry 0%" },
314
+ ".animate-range-entry-end": { animationRange: "entry 100%" },
315
+ ".animate-range-exit-start": { animationRange: "exit 0%" },
316
+ ".animate-range-exit-end": { animationRange: "exit 100%" },
317
+ });
318
+
319
+ // Animation Control Utilities
320
+ addUtilities({
321
+ ".animate-normal": { animationDirection: "normal" },
322
+ ".animate-reverse": { animationDirection: "reverse" },
323
+ ".animate-alternate": { animationDirection: "alternate" },
324
+ ".animate-alternate-reverse": { animationDirection: "alternate-reverse" },
325
+ ".animate-fill-none": { animationFillMode: "normal" },
326
+ ".animate-fill-forwards": { animationFillMode: "forwards" },
327
+ ".animate-fill-backwards": { animationFillMode: "backwards" },
328
+ ".animate-fill-both": { animationFillMode: "both" },
329
+ ".animate-infinite": { animationIterationCount: "infinite" },
330
+ ".animate-once": { animationIterationCount: "1" },
331
+ ".animate-twice": { animationIterationCount: "2" },
332
+ ".animate-thrice": { animationIterationCount: "3" },
333
+ ".animate-run": { animationPlayState: "running" },
334
+ ".animate-play": { animationPlayState: "running" },
335
+ ".animate-stop": { animationPlayState: "paused" },
336
+ ".animate-pause": { animationPlayState: "paused" },
337
+ ".animate-ease": { animationTimingFunction: "ease" },
338
+ ".animate-ease-linear": { animationTimingFunction: "linear" },
339
+ ".animate-ease-in": {
340
+ animationTimingFunction: "cubic-bezier(0.4, 0, 1, 1)",
341
+ },
342
+ ".animate-ease-out": {
343
+ animationTimingFunction: "cubic-bezier(0, 0, 0.2, 1)",
344
+ },
345
+ ".animate-ease-in-out": {
346
+ animationTimingFunction: "cubic-bezier(0.4, 0, 0.2, 1)",
347
+ },
348
+ ".animate-replace": { animationComposition: "replace" },
349
+ ".animate-add": { animationComposition: "add" },
350
+ ".animate-accumulate": { animationComposition: "accumulate" },
351
+ ".animate-duration-none": { animationDuration: "0s" },
352
+ ".animate-delay-none": { animationDelay: "0s" },
353
+ });
354
+
355
+ // Arbitrary values utilities
356
+ matchUtilities(
357
+ {
358
+ "animate-duration": (value) => ({
359
+ animationDuration: value,
360
+ }),
361
+ },
362
+ { values: theme("animationDuration") },
363
+ );
364
+
365
+ matchUtilities(
366
+ {
367
+ "animate-delay": (value) => ({
368
+ animationDelay: value,
369
+ }),
370
+ },
371
+ { values: theme("animationDelay") },
372
+ );
373
+
374
+ matchUtilities(
375
+ {
376
+ "animate-iteration": (value) => ({
377
+ animationIterationCount: value,
378
+ }),
379
+ },
380
+ { values: theme("animationIterationCount") },
381
+ );
382
+
383
+ matchUtilities(
384
+ {
385
+ "animate-ease": (value) => ({
386
+ animationTimingFunction: value,
387
+ }),
388
+ },
389
+ { values: theme("animationTimingFunction") },
390
+ );
391
+
392
+ matchUtilities({
393
+ timeline: (value) => ({
394
+ animationTimeline: value,
395
+ }),
396
+ });
397
+
398
+ matchUtilities({
399
+ "animate-range": (value) => ({
400
+ animationRange: value,
401
+ }),
402
+ });
403
+
404
+ matchUtilities({
405
+ "animate-range-start": (value) => ({
406
+ animationRangeStart: value,
407
+ }),
408
+ });
409
+
410
+ matchUtilities({
411
+ "animate-range-end": (value) => ({
412
+ animationRangeEnd: value,
413
+ }),
414
+ });
415
+ },
416
+ {
417
+ theme: {
418
+ extend: {
419
+ animationDuration: {},
420
+ animationDelay: {},
421
+ animationIterationCount: {},
422
+ animationTimingFunction: {},
423
+ },
424
+ },
425
+ },
426
+ );