Skip to content

Commit c8f0801

Browse files
committed
Adding vanilla motionValue
1 parent 2ad1dd7 commit c8f0801

File tree

8 files changed

+15
-24
lines changed

8 files changed

+15
-24
lines changed

packages/framer-motion/src/animation/animate/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import type {
44
DOMKeyframesDefinition,
55
AnimationOptions as DynamicAnimationOptions,
66
ElementOrSelector,
7-
GroupPlaybackControls,
87
MotionValue,
98
ValueAnimationTransition,
109
} from "motion-dom"
10+
import { GroupPlaybackControls } from "motion-dom"
1111
import { GenericKeyframesTarget } from "../../types"
1212
import {
1313
AnimationSequence,

packages/framer-motion/src/debug.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export { recordStats } from "../../motion-dom/src/stats"
2-
export type * from "../../motion-dom/src/stats/types"
1+
export type * from "motion-dom"
2+
export { recordStats } from "motion-dom"

packages/framer-motion/src/dom.ts

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
export {
2+
cancelFrame,
3+
frame,
4+
frameData,
25
hover,
36
isDragActive,
47
MotionValue,
58
motionValue,
69
press,
10+
time,
711
} from "motion-dom"
812
export { invariant, noop, progress } from "motion-utils"
913

@@ -44,8 +48,6 @@ export { spring } from "./animation/generators/spring"
4448
* Utils
4549
*/
4650
export { stagger } from "./animation/utils/stagger"
47-
export * from "./frameloop"
48-
export { time } from "./frameloop/sync-time"
4951
export { clamp } from "./utils/clamp"
5052
export { delayInSeconds as delay, DelayedFunction } from "./utils/delay"
5153
export * from "./utils/distance"
@@ -54,8 +56,3 @@ export { mix } from "./utils/mix"
5456
export { pipe } from "./utils/pipe"
5557
export { transform } from "./utils/transform"
5658
export { wrap } from "./utils/wrap"
57-
58-
/**
59-
* Deprecated
60-
*/
61-
export { cancelSync, sync } from "./frameloop/index-legacy"
+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
export { recordStats } from "../../motion-dom/src/stats"
2-
export { statsBuffer } from "../../motion-dom/src/stats/buffer"
1+
export { recordStats, statsBuffer } from "motion-dom"
32
export { calcBoxDelta } from "./projection/geometry/delta-calc"
43
export { nodeGroup } from "./projection/node/group"
54
export { HTMLProjectionNode } from "./projection/node/HTMLProjectionNode"
@@ -9,6 +8,6 @@ export { addScaleCorrector } from "./projection/styles/scale-correction"
98
export { HTMLVisualElement } from "./render/html/HTMLVisualElement"
109
export { buildTransform } from "./render/html/utils/build-transform"
1110
export { animateValue as animate, frame, frameData, mix }
11+
import { frame, frameData } from "motion-dom"
1212
import { animateValue } from "./animation/animators/MainThreadAnimation"
13-
import { frame, frameData } from "./frameloop"
1413
import { mix } from "./utils/mix"

packages/framer-motion/src/render/VisualElement.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import {
55
time,
66
type MotionValue,
77
} from "motion-dom"
8-
import { warnOnce } from "motion-utils"
9-
import { SubscriptionManager } from "../../../motion-utils/src/subscription-manager"
8+
import { SubscriptionManager, warnOnce } from "motion-utils"
109
import {
1110
MotionConfigContext,
1211
ReducedMotionConfig,

packages/framer-motion/src/value/use-will-change/WillChangeMotionValue.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { addUniqueItem } from "motion-utils"
33
import { getWillChangeName } from "./get-will-change-name"
44
import { WillChange } from "./types"
55

6-
export class WillChangeMotionValue extends MotionValue implements WillChange {
6+
export class WillChangeMotionValue
7+
extends MotionValue<string>
8+
implements WillChange
9+
{
710
private values: string[] = []
811

912
add(name: string) {
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { MotionValue } from "motion-dom"
22

3-
export interface WillChange extends MotionValue {
3+
export interface WillChange extends MotionValue<string> {
44
add(name: string): void
55
}

packages/motion-dom/src/value/index.ts

-7
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ export class MotionValue<V = any> {
134134

135135
/**
136136
* Tracks whether this value should be removed
137-
* @internal
138137
*/
139138
liveStyle?: boolean
140139

@@ -143,8 +142,6 @@ export class MotionValue<V = any> {
143142
* @param config - Optional configuration options
144143
*
145144
* - `transformer`: A function to transform incoming values with.
146-
*
147-
* @internal
148145
*/
149146
constructor(init: V, options: MotionValueOptions = {}) {
150147
this.setCurrent(init)
@@ -259,8 +256,6 @@ export class MotionValue<V = any> {
259256

260257
/**
261258
* Attaches a passive effect to the `MotionValue`.
262-
*
263-
* @internal
264259
*/
265260
attach(passiveEffect: PassiveEffect<V>, stopPassiveEffect: VoidFunction) {
266261
this.passiveEffect = passiveEffect
@@ -400,8 +395,6 @@ export class MotionValue<V = any> {
400395
* ```
401396
*
402397
* @param animation - A function that starts the provided animation
403-
*
404-
* @internal
405398
*/
406399
start(startAnimation: StartAnimation) {
407400
this.stop()

0 commit comments

Comments
 (0)