Skip to content

Commit 719536c

Browse files
author
Adam Plesnik
committed
Add 'no-animations:' variant, fix naming in splitAndCombine(),
change README; v0.2.5
1 parent 94c0c9c commit 719536c

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ Timeline scope allows to control animated elements outside the parent which defi
5050

5151
### Browser Support
5252

53-
Scroll-driven animations are not broadly supported yet. Use `@supports` rules for fallback styling.
53+
Scroll-driven animations are not broadly supported yet. Use the `no-animations:...` variant for fallback styling.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adam.plesnik/tailwindcss-scroll-driven-animations",
3-
"version": "0.2.1",
3+
"version": "0.2.5",
44
"author": "Adam Plesnik <[email protected]>",
55
"scripts": {
66
"build": "swc ./src/index.ts --out-dir ./dist"

src/index.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import plugin from 'tailwindcss/plugin'
22

33
export = plugin(
4-
function ({ matchUtilities, theme }) {
4+
function ({ matchUtilities, addVariant, theme }) {
55
matchUtilities(
66
{
77
timeline: (value, { modifier }) => ({
@@ -69,6 +69,8 @@ export = plugin(
6969
modifiers: 'any',
7070
}
7171
)
72+
73+
addVariant('no-animations', '@supports not (animation-range: cover)')
7274
},
7375

7476
{
@@ -83,9 +85,8 @@ export = plugin(
8385
)
8486

8587
function splitAndCombine(values: string, modifiers: string | null) {
86-
const defaultValueArray = ['0', '100%']
8788
const valueArray = (values || '').split(' ')
88-
const modifierArray = (modifiers || defaultValueArray.join(',')).split(',')
89+
const modifierArray = (modifiers || ['0,100%'].join(',')).split(',')
8990

9091
const combinedValues = [valueArray[0], modifierArray[0], valueArray[1], modifierArray[1]]
9192

0 commit comments

Comments
 (0)