motion-v 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +12 -2
- package/dist/es/animation/hooks/animation-controls.mjs +11 -0
- package/dist/{src → es}/features/gestures/drag/types.d.ts +1 -1
- package/dist/es/state/animate-updates.mjs +2 -2
- package/package.json +4 -4
- package/dist/src/animation/use-animate.d.ts +0 -8
- /package/dist/{src → es}/animation/hooks/animation-controls.d.ts +0 -0
- /package/dist/{src → es}/animation/hooks/use-animate.d.ts +0 -0
- /package/dist/{src → es}/animation/hooks/use-animation-controls.d.ts +0 -0
- /package/dist/{src → es}/animation/index.d.ts +0 -0
- /package/dist/{src → es}/animation/types.d.ts +0 -0
- /package/dist/{src → es}/animation/utils.d.ts +0 -0
- /package/dist/{src → es}/components/LayoutGroup.d.ts +0 -0
- /package/dist/{src → es}/components/animate-presence/AnimatePresence.d.ts +0 -0
- /package/dist/{src → es}/components/animate-presence/index.d.ts +0 -0
- /package/dist/{src → es}/components/animate-presence/types.d.ts +0 -0
- /package/dist/{src → es}/components/animate-presence/use-pop-layout.d.ts +0 -0
- /package/dist/{src → es}/components/animate-presence/use-presence.d.ts +0 -0
- /package/dist/{src → es}/components/animate-presence/utils.d.ts +0 -0
- /package/dist/{src → es}/components/context.d.ts +0 -0
- /package/dist/{src → es}/components/group.d.ts +0 -0
- /package/dist/{src → es}/components/hooks/use-motion-elm.d.ts +0 -0
- /package/dist/{src → es}/components/index.d.ts +0 -0
- /package/dist/{src → es}/components/motion/Motion.d.ts +0 -0
- /package/dist/{src → es}/components/motion/NameSpace.d.ts +0 -0
- /package/dist/{src → es}/components/motion/Primitive.d.ts +0 -0
- /package/dist/{src → es}/components/motion/Slot.d.ts +0 -0
- /package/dist/{src → es}/components/motion/index.d.ts +0 -0
- /package/dist/{src → es}/components/motion/renderSlotFragments.d.ts +0 -0
- /package/dist/{src → es}/components/motion/utils.d.ts +0 -0
- /package/dist/{src → es}/components/motion-config/MotionConfig.d.ts +0 -0
- /package/dist/{src → es}/components/motion-config/context.d.ts +0 -0
- /package/dist/{src → es}/components/motion-config/index.d.ts +0 -0
- /package/dist/{src → es}/components/motion-config/types.d.ts +0 -0
- /package/dist/{src → es}/components/presence.d.ts +0 -0
- /package/dist/{src → es}/components/use-force-update.d.ts +0 -0
- /package/dist/{src → es}/components/use-layout-group.d.ts +0 -0
- /package/dist/{src → es}/components/use-slot-change-index.d.ts +0 -0
- /package/dist/{src → es}/constants/index.d.ts +0 -0
- /package/dist/{src → es}/events/add-dom-event.d.ts +0 -0
- /package/dist/{src → es}/events/add-pointer-event.d.ts +0 -0
- /package/dist/{src → es}/events/event-info.d.ts +0 -0
- /package/dist/{src → es}/events/index.d.ts +0 -0
- /package/dist/{src → es}/events/types.d.ts +0 -0
- /package/dist/{src → es}/events/utils/index.d.ts +0 -0
- /package/dist/{src → es}/events/utils/is-primary-pointer.d.ts +0 -0
- /package/dist/{src → es}/features/animation/animation.d.ts +0 -0
- /package/dist/{src → es}/features/feature-manager.d.ts +0 -0
- /package/dist/{src → es}/features/feature.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/base.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/drag/VisualElementDragControls.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/drag/index.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/drag/lock.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/drag/use-drag-controls.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/drag/utils/constraints.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/drag/utils/is.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/focus/index.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/focus/types.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/hover/index.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/hover/types.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/in-view/index.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/in-view/types.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/index.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/pan/PanSession.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/pan/index.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/pan/types.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/press/index.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/press/types.d.ts +0 -0
- /package/dist/{src → es}/features/gestures/types.d.ts +0 -0
- /package/dist/{src → es}/features/index.d.ts +0 -0
- /package/dist/{src → es}/features/layout/config.d.ts +0 -0
- /package/dist/{src → es}/features/layout/layout.d.ts +0 -0
- /package/dist/{src → es}/features/layout/projection.d.ts +0 -0
- /package/dist/{src → es}/features/layout/types.d.ts +0 -0
- /package/dist/{src → es}/features/layout/utils.d.ts +0 -0
- /package/dist/{src → es}/features/svg.d.ts +0 -0
- /package/dist/{src → es}/index.d.ts +0 -0
- /package/dist/{src → es}/projection/conversion.d.ts +0 -0
- /package/dist/{src → es}/projection/geometry/delta-apply.d.ts +0 -0
- /package/dist/{src → es}/projection/geometry/delta-calc.d.ts +0 -0
- /package/dist/{src → es}/projection/geometry/models.d.ts +0 -0
- /package/dist/{src → es}/projection/node/types.d.ts +0 -0
- /package/dist/{src → es}/projection/utils/each-axis.d.ts +0 -0
- /package/dist/{src → es}/projection/utils/measure.d.ts +0 -0
- /package/dist/{src → es}/render/utils/setters.d.ts +0 -0
- /package/dist/{src → es}/shared/index.d.ts +0 -0
- /package/dist/{src → es}/shared/test.d.ts +0 -0
- /package/dist/{src → es}/state/animate-updates.d.ts +0 -0
- /package/dist/{src → es}/state/animate-variants-children.d.ts +0 -0
- /package/dist/{src → es}/state/animation/index.d.ts +0 -0
- /package/dist/{src → es}/state/animation/types.d.ts +0 -0
- /package/dist/{src → es}/state/create-visual-element.d.ts +0 -0
- /package/dist/{src → es}/state/event.d.ts +0 -0
- /package/dist/{src → es}/state/index.d.ts +0 -0
- /package/dist/{src → es}/state/motion-state.d.ts +0 -0
- /package/dist/{src → es}/state/style.d.ts +0 -0
- /package/dist/{src → es}/state/transform.d.ts +0 -0
- /package/dist/{src → es}/state/utils/is-present.d.ts +0 -0
- /package/dist/{src → es}/state/utils.d.ts +0 -0
- /package/dist/{src → es}/types/framer-motion.d.ts +0 -0
- /package/dist/{src → es}/types/index.d.ts +0 -0
- /package/dist/{src → es}/types/motion-values.d.ts +0 -0
- /package/dist/{src → es}/types/state.d.ts +0 -0
- /package/dist/{src → es}/types/transform.d.ts +0 -0
- /package/dist/{src → es}/utils/clamp.d.ts +0 -0
- /package/dist/{src → es}/utils/createContext.d.ts +0 -0
- /package/dist/{src → es}/utils/get-context-window.d.ts +0 -0
- /package/dist/{src → es}/utils/index.d.ts +0 -0
- /package/dist/{src → es}/utils/mix/number.d.ts +0 -0
- /package/dist/{src → es}/utils/motion-value.d.ts +0 -0
- /package/dist/{src → es}/utils/noop.d.ts +0 -0
- /package/dist/{src → es}/utils/progress.d.ts +0 -0
- /package/dist/{src → es}/utils/time-conversion.d.ts +0 -0
- /package/dist/{src → es}/utils/use-animation-frame.d.ts +0 -0
- /package/dist/{src → es}/utils/use-dom-ref.d.ts +0 -0
- /package/dist/{src → es}/utils/use-in-view.d.ts +0 -0
- /package/dist/{src → es}/value/index.d.ts +0 -0
- /package/dist/{src → es}/value/types/numbers/units.d.ts +0 -0
- /package/dist/{src → es}/value/use-combine-values.d.ts +0 -0
- /package/dist/{src → es}/value/use-computed.d.ts +0 -0
- /package/dist/{src → es}/value/use-motion-template.d.ts +0 -0
- /package/dist/{src → es}/value/use-motion-value-event.d.ts +0 -0
- /package/dist/{src → es}/value/use-scroll.d.ts +0 -0
- /package/dist/{src → es}/value/use-spring.d.ts +0 -0
- /package/dist/{src → es}/value/use-time.d.ts +0 -0
- /package/dist/{src → es}/value/use-transform.d.ts +0 -0
- /package/dist/{src → es}/value/use-velocity.d.ts +0 -0
- /package/dist/{src → es}/value/use-will-change/add-will-change.d.ts +0 -0
- /package/dist/{src → es}/value/use-will-change/is.d.ts +0 -0
- /package/dist/{src → es}/value/use-will-change/types.d.ts +0 -0
package/dist/cjs/index.js
CHANGED
|
@@ -8104,9 +8104,9 @@ function resolveStateAnimation(controlActiveState, animationOptions) {
|
|
|
8104
8104
|
}
|
|
8105
8105
|
function createAnimationFactories(prevTarget, animationOptions, controlDelay) {
|
|
8106
8106
|
const factories = [];
|
|
8107
|
-
|
|
8107
|
+
Object.keys(this.target).forEach((key) => {
|
|
8108
8108
|
var _a;
|
|
8109
|
-
if (!hasChanged(
|
|
8109
|
+
if (!hasChanged(prevTarget[key], this.target[key]))
|
|
8110
8110
|
return;
|
|
8111
8111
|
(_a = this.baseTarget)[key] ?? (_a[key] = style.get(this.element, key));
|
|
8112
8112
|
const keyValue = this.target[key] === "none" ? transformResetValue[key] : this.target[key];
|
|
@@ -9109,6 +9109,14 @@ function useAnimate() {
|
|
|
9109
9109
|
function stopAnimation(visualElement) {
|
|
9110
9110
|
visualElement.values.forEach((value) => value.stop());
|
|
9111
9111
|
}
|
|
9112
|
+
function setStateTarget(state2, definition) {
|
|
9113
|
+
const resolvedVariant = resolveVariant(definition, state2.options.variants, state2.options.custom);
|
|
9114
|
+
Object.entries(resolvedVariant).forEach(([key, value]) => {
|
|
9115
|
+
if (key === "transition")
|
|
9116
|
+
return;
|
|
9117
|
+
state2.target[key] = value;
|
|
9118
|
+
});
|
|
9119
|
+
}
|
|
9112
9120
|
function animationControls() {
|
|
9113
9121
|
let hasMounted = false;
|
|
9114
9122
|
const subscribers = /* @__PURE__ */ new Set();
|
|
@@ -9161,6 +9169,7 @@ function setValues(state2, definition) {
|
|
|
9161
9169
|
if (typeof definition === "string") {
|
|
9162
9170
|
return setVariants(state2, [definition]);
|
|
9163
9171
|
} else {
|
|
9172
|
+
setStateTarget(state2, definition);
|
|
9164
9173
|
setTarget(state2.visualElement, definition);
|
|
9165
9174
|
}
|
|
9166
9175
|
}
|
|
@@ -9170,6 +9179,7 @@ function setVariants(state2, variantLabels) {
|
|
|
9170
9179
|
reversedLabels.forEach((key) => {
|
|
9171
9180
|
const variant = visualElement.getVariant(key);
|
|
9172
9181
|
variant && setTarget(visualElement, variant);
|
|
9182
|
+
setStateTarget(state2, variant);
|
|
9173
9183
|
if (visualElement.variantChildren) {
|
|
9174
9184
|
visualElement.variantChildren.forEach((child) => {
|
|
9175
9185
|
setVariants(mountedStates.get(child.current), variantLabels);
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { mountedStates } from "../../state/motion-state.mjs";
|
|
2
2
|
import { invariant } from "hey-listen";
|
|
3
3
|
import { setTarget } from "../../external/.pnpm/framer-motion@11.16.6/external/framer-motion/dist/es/render/utils/setters.mjs";
|
|
4
|
+
import { resolveVariant } from "../../state/utils.mjs";
|
|
4
5
|
function stopAnimation(visualElement) {
|
|
5
6
|
visualElement.values.forEach((value) => value.stop());
|
|
6
7
|
}
|
|
8
|
+
function setStateTarget(state, definition) {
|
|
9
|
+
const resolvedVariant = resolveVariant(definition, state.options.variants, state.options.custom);
|
|
10
|
+
Object.entries(resolvedVariant).forEach(([key, value]) => {
|
|
11
|
+
if (key === "transition")
|
|
12
|
+
return;
|
|
13
|
+
state.target[key] = value;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
7
16
|
function animationControls() {
|
|
8
17
|
let hasMounted = false;
|
|
9
18
|
const subscribers = /* @__PURE__ */ new Set();
|
|
@@ -56,6 +65,7 @@ function setValues(state, definition) {
|
|
|
56
65
|
if (typeof definition === "string") {
|
|
57
66
|
return setVariants(state, [definition]);
|
|
58
67
|
} else {
|
|
68
|
+
setStateTarget(state, definition);
|
|
59
69
|
setTarget(state.visualElement, definition);
|
|
60
70
|
}
|
|
61
71
|
}
|
|
@@ -65,6 +75,7 @@ function setVariants(state, variantLabels) {
|
|
|
65
75
|
reversedLabels.forEach((key) => {
|
|
66
76
|
const variant = visualElement.getVariant(key);
|
|
67
77
|
variant && setTarget(visualElement, variant);
|
|
78
|
+
setStateTarget(state, variant);
|
|
68
79
|
if (visualElement.variantChildren) {
|
|
69
80
|
visualElement.variantChildren.forEach((child) => {
|
|
70
81
|
setVariants(mountedStates.get(child.current), variantLabels);
|
|
@@ -82,7 +82,7 @@ export interface DragHandlers {
|
|
|
82
82
|
*/
|
|
83
83
|
onDragTransitionEnd?: () => void;
|
|
84
84
|
/**
|
|
85
|
-
* If `dragConstraints` is set to a
|
|
85
|
+
* If `dragConstraints` is set to a HTMLElement, this callback will call with the measured drag constraints.
|
|
86
86
|
*
|
|
87
87
|
* @public
|
|
88
88
|
*/
|
|
@@ -60,9 +60,9 @@ function resolveStateAnimation(controlActiveState, animationOptions) {
|
|
|
60
60
|
}
|
|
61
61
|
function createAnimationFactories(prevTarget, animationOptions, controlDelay) {
|
|
62
62
|
const factories = [];
|
|
63
|
-
|
|
63
|
+
Object.keys(this.target).forEach((key) => {
|
|
64
64
|
var _a;
|
|
65
|
-
if (!hasChanged(
|
|
65
|
+
if (!hasChanged(prevTarget[key], this.target[key]))
|
|
66
66
|
return;
|
|
67
67
|
(_a = this.baseTarget)[key] ?? (_a[key] = style.get(this.element, key));
|
|
68
68
|
const keyValue = this.target[key] === "none" ? transformResetValue[key] : this.target[key];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motion-v",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"sideEffects": false,
|
|
18
18
|
"exports": {
|
|
19
19
|
".": {
|
|
20
|
-
"types": "./dist/
|
|
20
|
+
"types": "./dist/es/index.d.ts",
|
|
21
21
|
"import": "./dist/es/index.mjs",
|
|
22
22
|
"require": "./dist/cjs/index.js"
|
|
23
23
|
},
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
},
|
|
35
35
|
"main": "./dist/cjs/index.js",
|
|
36
36
|
"module": "./dist/es/index.mjs",
|
|
37
|
-
"types": "./dist/
|
|
37
|
+
"types": "./dist/es/index.d.ts",
|
|
38
38
|
"typesVersions": {
|
|
39
39
|
"*": {
|
|
40
40
|
"*": [
|
|
41
41
|
"./dist/*/index.d.ts",
|
|
42
|
-
"./dist/
|
|
42
|
+
"./dist/es/index.d.ts"
|
|
43
43
|
],
|
|
44
44
|
"nuxt": [
|
|
45
45
|
"./dist/nuxt/index.d.mts",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AnimationPlaybackControls } from 'framer-motion';
|
|
2
|
-
import { Ref, UnwrapRef } from 'vue';
|
|
3
|
-
import { createScopedAnimate } from 'framer-motion/dom';
|
|
4
|
-
type Scope = Ref<UnwrapRef<Element>> & {
|
|
5
|
-
animations: AnimationPlaybackControls[];
|
|
6
|
-
};
|
|
7
|
-
export declare function useAnimate<T extends Element = any>(): [Scope, ReturnType<typeof createScopedAnimate>];
|
|
8
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|