Skip to content

Commit dc65e0e

Browse files
committed
Refactoring AnimationType to test effect on bundle size
1 parent 799dcbb commit dc65e0e

File tree

8 files changed

+17
-19
lines changed

8 files changed

+17
-19
lines changed

src/gestures/drag/VisualElementDragControls.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { calcOrigin } from "../../utils/geometry/delta-calc"
2828
import { startAnimation } from "../../animation/utils/transitions"
2929
import { Transition } from "../../types"
3030
import { MotionProps } from "../../motion"
31-
import { AnimationType } from "../../render/utils/animation-state"
31+
import { AnimationType } from "../../render/utils/types"
3232
import { VisualElement } from "../../render/types"
3333

3434
export const elementDragControls = new WeakMap<

src/gestures/use-hover-gesture.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { TargetAndTransition } from "../types"
22
import { isMouseEvent } from "./utils/event-type"
33
import { EventInfo } from "../events/types"
4-
import { AnimationType } from "../render/utils/animation-state"
4+
import { AnimationType } from "../render/utils/types"
55
import { VariantLabels } from "../motion/types"
66
import { usePointerEvent } from "../events/use-pointer-event"
77
import { VisualElement } from "../render/types"

src/gestures/use-tap-gesture.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { addPointerEvent, usePointerEvent } from "../events/use-pointer-event"
66
import { useUnmountEffect } from "../utils/use-unmount-effect"
77
import { pipe } from "popmotion"
88
import { Point2D } from "../types/geometry"
9-
import { AnimationType } from "../render/utils/animation-state"
9+
import { AnimationType } from "../render/utils/types"
1010
import { VariantLabels } from "../motion/types"
1111
import { isDragActive } from "./drag/utils/lock"
1212
import { VisualElement } from "../render/types"

src/motion/features/exit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { FeatureProps, MotionFeature } from "./types"
44
import { checkShouldInheritVariant } from "../utils/should-inherit-variant"
55
import { usePresence } from "../../components/AnimatePresence/use-presence"
66
import { PresenceContext } from "../../components/AnimatePresence/PresenceContext"
7-
import { AnimationType } from "../../render/utils/animation-state"
7+
import { AnimationType } from "../../render/utils/types"
88

99
/**
1010
* TODO: This component is quite small and no longer directly imports animation code.

src/render/utils/__tests__/animation-state.test.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { axisBox } from "../../../utils/geometry"
22
import { ResolvedValues, VisualElement } from "../../types"
3-
import {
4-
AnimationState,
5-
AnimationType,
6-
createAnimationState,
7-
} from "../animation-state"
3+
import { AnimationState, createAnimationState } from "../animation-state"
4+
import { AnimationType } from "../types"
85
import { checkTargetForNewValues, getOrigin } from "../setters"
96
import { visualElement } from "../../"
107
import { MotionProps } from "../../../motion"

src/render/utils/animation-state.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
AnimationDefinition,
1010
AnimationOptions,
1111
} from "./animation"
12+
import { AnimationType } from "./types"
1213
import { isVariantLabel, isVariantLabels, resolveVariant } from "./variants"
1314

1415
export interface AnimationState {
@@ -31,15 +32,6 @@ interface DefinitionAndOptions {
3132
options?: AnimationOptions
3233
}
3334

34-
export enum AnimationType {
35-
Animate = "animate",
36-
Hover = "whileHover",
37-
Tap = "whileTap",
38-
Drag = "whileDrag",
39-
Focus = "whileFocus",
40-
Exit = "exit",
41-
}
42-
4335
export type AnimationList = string[] | TargetAndTransition[]
4436

4537
export const variantPriorityOrder = [

src/render/utils/animation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import {
88
Transition,
99
} from "../../types"
1010
import { VisualElement } from "../types"
11-
import { AnimationType, AnimationTypeState } from "./animation-state"
11+
import { AnimationTypeState } from "./animation-state"
12+
import { AnimationType } from "./types"
1213
import { setTarget } from "./setters"
1314
import { resolveVariant } from "./variants"
1415

src/render/utils/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export enum AnimationType {
2+
Animate = "animate",
3+
Hover = "whileHover",
4+
Tap = "whileTap",
5+
Drag = "whileDrag",
6+
Focus = "whileFocus",
7+
Exit = "exit",
8+
}

0 commit comments

Comments
 (0)