motion-v 0.6.2 → 0.7.1
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 +408 -221
- package/dist/es/animation/hooks/animation-controls.mjs +78 -0
- package/dist/es/animation/{use-animate.mjs → hooks/use-animate.mjs} +1 -1
- package/dist/es/animation/hooks/use-animation-controls.mjs +16 -0
- package/dist/es/animation/utils.mjs +6 -0
- package/dist/es/components/animate-presence/AnimatePresence.vue.mjs +5 -1
- package/dist/es/components/{Motion.vue.mjs → motion/Motion.vue.mjs} +11 -8
- package/dist/es/components/motion/NameSpace.mjs +47 -0
- package/dist/es/constants/index.mjs +2 -1
- package/dist/es/features/animation/animation.mjs +33 -0
- package/dist/es/features/feature-manager.mjs +5 -1
- package/dist/es/features/gestures/drag/use-drag-controls.mjs +43 -0
- package/dist/es/features/gestures/focus/index.mjs +36 -0
- package/dist/es/features/gestures/in-view/index.mjs +25 -5
- package/dist/es/features/layout/projection.mjs +7 -30
- package/dist/es/index.mjs +11 -5
- package/dist/es/state/animate-updates.mjs +129 -0
- package/dist/es/state/motion-state.mjs +19 -120
- package/dist/es/state/style.mjs +2 -2
- package/dist/es/state/transform.mjs +1 -0
- package/dist/src/animation/hooks/animation-controls.d.ts +8 -0
- package/dist/src/animation/hooks/use-animate.d.ts +8 -0
- package/dist/src/animation/hooks/use-animation-controls.d.ts +33 -0
- package/dist/src/animation/index.d.ts +2 -1
- package/dist/src/animation/types.d.ts +68 -0
- package/dist/src/animation/utils.d.ts +2 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/{Motion.d.ts → motion/Motion.d.ts} +1 -1
- package/dist/src/components/motion/NameSpace.d.ts +11 -0
- package/dist/src/components/motion/index.d.ts +2 -0
- package/dist/src/features/animation/animation.d.ts +13 -0
- package/dist/src/features/gestures/drag/VisualElementDragControls.d.ts +1 -1
- package/dist/src/features/gestures/focus/index.d.ts +7 -0
- package/dist/src/features/gestures/focus/types.d.ts +6 -0
- package/dist/src/features/gestures/in-view/index.d.ts +2 -0
- package/dist/src/features/index.d.ts +1 -0
- package/dist/src/features/layout/projection.d.ts +1 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/state/animate-updates.d.ts +19 -0
- package/dist/src/state/animate-variants-children.d.ts +2 -2
- package/dist/src/state/animation/index.d.ts +0 -0
- package/dist/src/state/animation/types.d.ts +0 -0
- package/dist/src/state/motion-state.d.ts +5 -4
- package/dist/src/state/utils.d.ts +4 -4
- package/dist/src/types/framer-motion.d.ts +17 -0
- package/dist/src/types/state.d.ts +10 -16
- package/package.json +3 -3
- package/dist/es/external/.pnpm/@vueuse_shared@12.0.0_typescript@5.7.2/external/@vueuse/shared/index.mjs +0 -6
- package/dist/es/state/animate-variants-children.mjs +0 -74
- /package/dist/es/components/{Motion.vue2.mjs → motion/Motion.vue2.mjs} +0 -0
- /package/dist/es/components/{Primitive.mjs → motion/Primitive.mjs} +0 -0
- /package/dist/es/components/{Slot.mjs → motion/Slot.mjs} +0 -0
- /package/dist/es/components/{renderSlotFragments.mjs → motion/renderSlotFragments.mjs} +0 -0
- /package/dist/es/components/{utils.mjs → motion/utils.mjs} +0 -0
- /package/dist/src/{animation/use-animation.d.ts → components/animate-presence/utils.d.ts} +0 -0
- /package/dist/src/components/{Primitive.d.ts → motion/Primitive.d.ts} +0 -0
- /package/dist/src/components/{Slot.d.ts → motion/Slot.d.ts} +0 -0
- /package/dist/src/components/{renderSlotFragments.d.ts → motion/renderSlotFragments.d.ts} +0 -0
- /package/dist/src/components/{utils.d.ts → motion/utils.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motion-v",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,17 +55,17 @@
|
|
|
55
55
|
"vue": ">=3.0.0"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@vueuse/core": "^
|
|
58
|
+
"@vueuse/core": "^10.0.0",
|
|
59
59
|
"framer-motion": "11.16.6",
|
|
60
60
|
"hey-listen": "^1.0.8",
|
|
61
61
|
"motion-dom": "^11.16.4"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
+
"@testing-library/vue": "^8.1.0",
|
|
64
65
|
"@vitejs/plugin-vue": "^5.1.4",
|
|
65
66
|
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
|
66
67
|
"@vitest/coverage-v8": "^1.4.0",
|
|
67
68
|
"@vue/test-utils": "^2.4.5",
|
|
68
|
-
"framer-motion": "^11.15.0",
|
|
69
69
|
"happy-dom": "^16.0.1",
|
|
70
70
|
"jsdom": "^24.0.0",
|
|
71
71
|
"vite": "^5.4.8",
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { style } from "./style.mjs";
|
|
2
|
-
import { transformResetValue } from "./transform.mjs";
|
|
3
|
-
import { resolveVariant, hasChanged, getOptions } from "./utils.mjs";
|
|
4
|
-
import { animate } from "../external/.pnpm/framer-motion@11.16.6/external/framer-motion/dist/es/animation/animate/index.mjs";
|
|
5
|
-
function animateVariantsChildren(state, activeState, isFirstAnimate = false) {
|
|
6
|
-
const variantChildren = state.visualElement.variantChildren;
|
|
7
|
-
if (!(variantChildren == null ? void 0 : variantChildren.size)) {
|
|
8
|
-
return {
|
|
9
|
-
animations: [],
|
|
10
|
-
getAnimations: () => Promise.resolve()
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
const animationFactories = [];
|
|
14
|
-
Array.from(variantChildren).forEach((child, index) => {
|
|
15
|
-
var _a;
|
|
16
|
-
const prevTarget = isFirstAnimate ? child.state.baseTarget : child.state.target;
|
|
17
|
-
const childState = child.state;
|
|
18
|
-
childState.target = {};
|
|
19
|
-
for (const name in activeState) {
|
|
20
|
-
if (name === "initial" && !isFirstAnimate) {
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
const { definition, transition } = activeState[name];
|
|
24
|
-
const { staggerChildren = 0, staggerDirection = 1, delayChildren = 0 } = transition || {};
|
|
25
|
-
const maxStaggerDuration = (variantChildren.size - 1) * staggerChildren;
|
|
26
|
-
const generateStaggerDuration = staggerDirection === 1 ? (i = 0) => i * staggerChildren : (i = 0) => maxStaggerDuration - i * staggerChildren;
|
|
27
|
-
const variant = resolveVariant(
|
|
28
|
-
definition,
|
|
29
|
-
child.props.variants,
|
|
30
|
-
child.props.custom
|
|
31
|
-
);
|
|
32
|
-
const animationOptions = {};
|
|
33
|
-
const allTarget = { ...prevTarget, ...variant };
|
|
34
|
-
for (const key in allTarget) {
|
|
35
|
-
if (key === "transition")
|
|
36
|
-
continue;
|
|
37
|
-
childState.target[key] = allTarget[key];
|
|
38
|
-
if (childState.target[key] === void 0) {
|
|
39
|
-
childState.target[key] = childState.baseTarget[key];
|
|
40
|
-
}
|
|
41
|
-
if (hasChanged(prevTarget[key], childState.target[key])) {
|
|
42
|
-
(_a = childState.baseTarget)[key] ?? (_a[key] = style.get(child.current, key));
|
|
43
|
-
animationOptions[key] = getOptions(
|
|
44
|
-
Object.assign({}, transition, allTarget.transition, child.props.transition),
|
|
45
|
-
key
|
|
46
|
-
);
|
|
47
|
-
const keyValue = childState.target[key] === "none" ? transformResetValue[key] : childState.target[key];
|
|
48
|
-
animationFactories.push(
|
|
49
|
-
() => {
|
|
50
|
-
var _a2;
|
|
51
|
-
return animate(
|
|
52
|
-
child.current,
|
|
53
|
-
{
|
|
54
|
-
[key]: keyValue
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
...animationOptions[key] || {},
|
|
58
|
-
delay: (((_a2 = animationOptions[key]) == null ? void 0 : _a2.delay) || 0) + delayChildren + generateStaggerDuration(index)
|
|
59
|
-
}
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
return {
|
|
68
|
-
animations: animationFactories,
|
|
69
|
-
getAnimations: () => Promise.all(animationFactories.map((factory) => factory()))
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
export {
|
|
73
|
-
animateVariantsChildren
|
|
74
|
-
};
|
|
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
|