|
| 1 | +/** |
| 2 | + * TailwindCSS v4.0 compatible replacement for `tailwindcss-animate`. |
| 3 | + * |
| 4 | + * WARNING: The asterisks are not supported by some formatters and linters. You |
| 5 | + * might want to exclude this file from formatters and linters for now. |
| 6 | + * |
| 7 | + * @author Luca Bosin <https://github.com/Wombosvideo> |
| 8 | + * @license MIT |
| 9 | + */ |
| 10 | + |
| 11 | +@theme inline { |
| 12 | + --animation-delay-0: 0s; |
| 13 | + --animation-delay-75: 75ms; |
| 14 | + --animation-delay-100: 0.1s; |
| 15 | + --animation-delay-150: 0.15s; |
| 16 | + --animation-delay-200: 0.2s; |
| 17 | + --animation-delay-300: 0.3s; |
| 18 | + --animation-delay-500: 0.5s; |
| 19 | + --animation-delay-700: 0.7s; |
| 20 | + --animation-delay-1000: 1s; |
| 21 | + |
| 22 | + --animation-repeat-0: 0; |
| 23 | + --animation-repeat-1: 1; |
| 24 | + --animation-repeat-infinite: infinite; |
| 25 | + |
| 26 | + --animation-direction-normal: normal; |
| 27 | + --animation-direction-reverse: reverse; |
| 28 | + --animation-direction-alternate: alternate; |
| 29 | + --animation-direction-alternate-reverse: alternate-reverse; |
| 30 | + |
| 31 | + --animation-fill-mode-none: none; |
| 32 | + --animation-fill-mode-forwards: forwards; |
| 33 | + --animation-fill-mode-backwards: backwards; |
| 34 | + --animation-fill-mode-both: both; |
| 35 | + |
| 36 | + --animate-in: var(--tw-duration, 150ms) var(--tw-ease, ease) enter; |
| 37 | + --animate-out: var(--tw-duration, 150ms) var(--tw-ease, ease) exit; |
| 38 | + |
| 39 | + --percentage-0: 0; |
| 40 | + --percentage-5: 0.05; |
| 41 | + --percentage-10: 0.1; |
| 42 | + --percentage-15: 0.15; |
| 43 | + --percentage-20: 0.2; |
| 44 | + --percentage-25: 0.25; |
| 45 | + --percentage-30: 0.3; |
| 46 | + --percentage-35: 0.35; |
| 47 | + --percentage-40: 0.4; |
| 48 | + --percentage-45: 0.45; |
| 49 | + --percentage-50: 0.5; |
| 50 | + --percentage-55: 0.55; |
| 51 | + --percentage-60: 0.6; |
| 52 | + --percentage-65: 0.65; |
| 53 | + --percentage-70: 0.7; |
| 54 | + --percentage-75: 0.75; |
| 55 | + --percentage-80: 0.8; |
| 56 | + --percentage-85: 0.85; |
| 57 | + --percentage-90: 0.9; |
| 58 | + --percentage-95: 0.95; |
| 59 | + --percentage-100: 1; |
| 60 | + |
| 61 | + --translate-1/2: 50%; |
| 62 | + --translate-1/3: 33.333333%; |
| 63 | + --translate-2/3: 66.666667%; |
| 64 | + --translate-1/4: 25%; |
| 65 | + --translate-2/4: 50%; |
| 66 | + --translate-3/4: 75%; |
| 67 | + --translate-full: 100%; |
| 68 | + --translate-px: 1px; |
| 69 | + --translate-0: 0px; |
| 70 | + --translate-0.5: 0.125rem; |
| 71 | + --translate-1: 0.25rem; |
| 72 | + --translate-1.5: 0.375rem; |
| 73 | + --translate-2: 0.5rem; |
| 74 | + --translate-2.5: 0.625rem; |
| 75 | + --translate-3: 0.75rem; |
| 76 | + --translate-3.5: 0.875rem; |
| 77 | + --translate-4: 1rem; |
| 78 | + --translate-5: 1.25rem; |
| 79 | + --translate-6: 1.5rem; |
| 80 | + --translate-7: 1.75rem; |
| 81 | + --translate-8: 2rem; |
| 82 | + --translate-9: 2.25rem; |
| 83 | + --translate-10: 2.5rem; |
| 84 | + --translate-11: 2.75rem; |
| 85 | + --translate-12: 3rem; |
| 86 | + --translate-14: 3.5rem; |
| 87 | + --translate-16: 4rem; |
| 88 | + --translate-20: 5rem; |
| 89 | + --translate-24: 6rem; |
| 90 | + --translate-28: 7rem; |
| 91 | + --translate-32: 8rem; |
| 92 | + --translate-36: 9rem; |
| 93 | + --translate-40: 10rem; |
| 94 | + --translate-44: 11rem; |
| 95 | + --translate-48: 12rem; |
| 96 | + --translate-52: 13rem; |
| 97 | + --translate-56: 14rem; |
| 98 | + --translate-60: 15rem; |
| 99 | + --translate-64: 16rem; |
| 100 | + --translate-72: 18rem; |
| 101 | + --translate-80: 20rem; |
| 102 | + --translate-96: 24rem; |
| 103 | + |
| 104 | + @keyframes enter { |
| 105 | + from { |
| 106 | + opacity: var(--tw-enter-opacity, 1); |
| 107 | + transform: translate3d( |
| 108 | + var(--tw-enter-translate-x, 0), |
| 109 | + var(--tw-enter-translate-y, 0), |
| 110 | + 0 |
| 111 | + ) |
| 112 | + scale3d( |
| 113 | + var(--tw-enter-scale, 1), |
| 114 | + var(--tw-enter-scale, 1), |
| 115 | + var(--tw-enter-scale, 1) |
| 116 | + ) |
| 117 | + rotate(var(--tw-enter-rotate, 0)); |
| 118 | + } |
| 119 | + } |
| 120 | + |
| 121 | + @keyframes exit { |
| 122 | + to { |
| 123 | + opacity: var(--tw-exit-opacity, 1); |
| 124 | + transform: translate3d( |
| 125 | + var(--tw-exit-translate-x, 0), |
| 126 | + var(--tw-exit-translate-y, 0), |
| 127 | + 0 |
| 128 | + ) |
| 129 | + scale3d( |
| 130 | + var(--tw-exit-scale, 1), |
| 131 | + var(--tw-exit-scale, 1), |
| 132 | + var(--tw-exit-scale, 1) |
| 133 | + ) |
| 134 | + rotate(var(--tw-exit-rotate, 0)); |
| 135 | + } |
| 136 | + } |
| 137 | +} |
| 138 | + |
| 139 | +/* |
| 140 | + * Tailwind's default `duration` utility sets the `--tw-duration` variable, so |
| 141 | + * can set `animation-duration` directly in the animation definition in the |
| 142 | + * `@theme` section above. Same goes for the `animation-timing-function`, set |
| 143 | + * with `--tw-ease`. |
| 144 | + */ |
| 145 | + |
| 146 | +@utility delay-* { |
| 147 | + animation-delay: calc(--value(number) * 1ms); |
| 148 | + animation-delay: --value(--animation-delay-*, [duration], [*]); |
| 149 | +} |
| 150 | + |
| 151 | +@utility repeat-* { |
| 152 | + animation-iteration-count: --value(--animation-repeat-*, integer); |
| 153 | +} |
| 154 | + |
| 155 | +@utility direction-* { |
| 156 | + animation-direction: --value(--animation-direction-*); |
| 157 | +} |
| 158 | + |
| 159 | +@utility fill-mode-* { |
| 160 | + animation-fill-mode: --value(--animation-fill-mode-*); |
| 161 | +} |
| 162 | + |
| 163 | +@utility running { |
| 164 | + animation-play-state: running; |
| 165 | +} |
| 166 | +@utility paused { |
| 167 | + animation-play-state: paused; |
| 168 | +} |
| 169 | + |
| 170 | +@utility fade-in { |
| 171 | + --tw-enter-opacity: 0; |
| 172 | +} |
| 173 | +@utility fade-in-* { |
| 174 | + --tw-enter-opacity: --value(--percentage-*, [*]); |
| 175 | +} |
| 176 | + |
| 177 | +@utility fade-out { |
| 178 | + --tw-exit-opacity: 0; |
| 179 | +} |
| 180 | +@utility fade-out-* { |
| 181 | + --tw-exit-opacity: --value(--percentage-*, [*]); |
| 182 | +} |
| 183 | + |
| 184 | +@utility zoom-in { |
| 185 | + --tw-enter-scale: 0; |
| 186 | +} |
| 187 | +@utility zoom-in-* { |
| 188 | + --tw-enter-scale: calc(--value([percentage]) / 100%); |
| 189 | + --tw-enter-scale: calc(--value([ratio], [number])); |
| 190 | + --tw-enter-scale: --value(--percentage-*); |
| 191 | +} |
| 192 | + |
| 193 | +@utility zoom-out { |
| 194 | + --tw-exit-scale: 0; |
| 195 | +} |
| 196 | +@utility zoom-out-* { |
| 197 | + --tw-exit-scale: calc(--value([percentage]) / 100%); |
| 198 | + --tw-exit-scale: calc(--value([ratio], [number])); |
| 199 | + --tw-exit-scale: --value(--percentage-*); |
| 200 | +} |
| 201 | + |
| 202 | +@utility spin-in { |
| 203 | + --tw-enter-rotate: 30deg; |
| 204 | +} |
| 205 | +@utility spin-in-* { |
| 206 | + --tw-enter-rotate: calc(--value(number) * 1deg); |
| 207 | + --tw-enter-rotate: --value(--rotate-*, [angle]); |
| 208 | +} |
| 209 | + |
| 210 | +@utility spin-out { |
| 211 | + --tw-exit-rotate: 30deg; |
| 212 | +} |
| 213 | +@utility spin-out-* { |
| 214 | + --tw-exit-rotate: calc(--value(number) * 1deg); |
| 215 | + --tw-exit-rotate: --value(--rotate-*, [angle]); |
| 216 | +} |
| 217 | + |
| 218 | +@utility slide-in-from-top { |
| 219 | + --tw-enter-translate-y: -100%; |
| 220 | +} |
| 221 | +@utility slide-in-from-top-* { |
| 222 | + --tw-enter-translate-y: calc(--value(integer) * var(--spacing) * -1); |
| 223 | + --tw-enter-translate-y: calc(--value(--translate-*, [percentage], ratio, [length]) * -1); |
| 224 | +} |
| 225 | + |
| 226 | +@utility slide-in-from-bottom { |
| 227 | + --tw-enter-translate-y: 100%; |
| 228 | +} |
| 229 | +@utility slide-in-from-bottom-* { |
| 230 | + --tw-enter-translate-y: calc(--value(integer) * var(--spacing)); |
| 231 | + --tw-enter-translate-y: --value(--translate-*, [percentage], ratio, [length]); |
| 232 | +} |
| 233 | +@utility slide-in-from-left { |
| 234 | + --tw-enter-translate-x: -100%; |
| 235 | +} |
| 236 | +@utility slide-in-from-left-* { |
| 237 | + --tw-enter-translate-x: calc(--value(integer) * var(--spacing) * -1); |
| 238 | + --tw-enter-translate-x: calc(--value(--translate-*, [percentage], ratio, [length]) * -1); |
| 239 | +} |
| 240 | +@utility slide-in-from-right { |
| 241 | + --tw-enter-translate-x: 100%; |
| 242 | +} |
| 243 | +@utility slide-in-from-right-* { |
| 244 | + --tw-enter-translate-x: calc(--value(integer) * var(--spacing)); |
| 245 | + --tw-enter-translate-x: --value(--translate-*, [percentage], ratio, [length]); |
| 246 | +} |
| 247 | + |
| 248 | +@utility slide-out-to-top { |
| 249 | + --tw-exit-translate-y: -100%; |
| 250 | +} |
| 251 | +@utility slide-out-to-top-* { |
| 252 | + --tw-exit-translate-y: calc(--value(integer) * var(--spacing) * -1); |
| 253 | + --tw-exit-translate-y: calc(--value(--translate-*, [percentage], ratio, [length]) * -1); |
| 254 | +} |
| 255 | +@utility slide-out-to-bottom { |
| 256 | + --tw-exit-translate-y: 100%; |
| 257 | +} |
| 258 | +@utility slide-out-to-bottom-* { |
| 259 | + --tw-exit-translate-y: calc(--value(integer) * var(--spacing)); |
| 260 | + --tw-exit-translate-y: --value(--translate-*, [percentage], ratio, [length]); |
| 261 | +} |
| 262 | +@utility slide-out-to-left { |
| 263 | + --tw-exit-translate-x: -100%; |
| 264 | +} |
| 265 | +@utility slide-out-to-left-* { |
| 266 | + --tw-exit-translate-x: calc(--value(integer) * var(--spacing) * -1); |
| 267 | + --tw-exit-translate-x: calc(--value(--translate-*, [percentage], ratio, [length]) * -1); |
| 268 | +} |
| 269 | +@utility slide-out-to-right { |
| 270 | + --tw-exit-translate-x: 100%; |
| 271 | +} |
| 272 | +@utility slide-out-to-right-* { |
| 273 | + --tw-exit-translate-x: calc(--value(integer) * var(--spacing)); |
| 274 | + --tw-exit-translate-x: --value(--translate-*, [percentage], ratio, [length]); |
| 275 | +} |
0 commit comments