File size: 486 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import * as G from './globals'
import { is, isSSR } from './helpers'
import { cssVariableRegex } from './regexs'
// Not all strings can be animated (eg: {display: "none"})
export function isAnimatedString(value: unknown): value is string {
return (
is.str(value) &&
(value[0] == '#' ||
/\d/.test(value) ||
// Do not identify a CSS variable as an AnimatedString if its SSR
(!isSSR() && cssVariableRegex.test(value)) ||
value in (G.colors || {}))
)
}
|