-
-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathvariants.ts
89 lines (80 loc) · 2.44 KB
/
variants.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import type { CSSProperties } from 'vue'
import type { ResolvedSingleTarget, Transition } from './transitions'
/**
* Permissive properties keys
*/
export type PropertiesKeys = Record<string, string | number | undefined | any>
/**
* SVG Supported properties
*/
export interface SVGPathProperties {
pathLength?: number
pathOffset?: number
pathSpacing?: number
}
/**
* Transform properties
*/
export type TransformValue = string | number
export interface TransformProperties {
x?: TransformValue | TransformValue[]
y?: TransformValue | TransformValue[]
z?: TransformValue | TransformValue[]
translateX?: TransformValue | TransformValue[]
translateY?: TransformValue | TransformValue[]
translateZ?: TransformValue | TransformValue[]
rotate?: TransformValue | TransformValue[]
rotateX?: TransformValue | TransformValue[]
rotateY?: TransformValue | TransformValue[]
rotateZ?: TransformValue | TransformValue[]
scale?: TransformValue | TransformValue[]
scaleX?: TransformValue | TransformValue[]
scaleY?: TransformValue | TransformValue[]
scaleZ?: TransformValue | TransformValue[]
skew?: TransformValue | TransformValue[]
skewX?: TransformValue | TransformValue[]
skewY?: TransformValue | TransformValue[]
originX?: TransformValue | TransformValue[]
originY?: TransformValue | TransformValue[]
originZ?: TransformValue | TransformValue[]
perspective?: TransformValue | TransformValue[]
transformPerspective?: TransformValue | TransformValue[]
}
/**
* Relevant styling properties
*/
export type StyleProperties = Omit<CSSProperties, 'transition' | 'rotate' | 'scale' | 'perspective' | 'transform' | 'transformBox' | 'transformOrigin' | 'transformStyle'>
/**
* Available properties for useMotion variants
*/
export type MotionProperties = StyleProperties | TransformProperties | SVGPathProperties
/**
* Permissive properties for useSpring
*/
export type PermissiveMotionProperties = MotionProperties & Record<string, ResolvedSingleTarget>
/**
* Variant
*/
export type Variant = {
transition?: Transition
} & MotionProperties
/**
* Motion variants object
*/
export type MotionVariants<T extends string> = {
// Initial variant
initial?: Variant
// Lifecycle hooks variants
enter?: Variant
leave?: Variant
// Intersection observer variants
visible?: Variant
visibleOnce?: Variant
// Event listeners variants
hovered?: Variant
tapped?: Variant
focused?: Variant
} & {
// Custom variants
[key in T]?: Variant
}