motion-v 0.12.0-beta.2 → 0.13.0-beta.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 +34 -46
- package/dist/es/animation/hooks/use-reduced-motion.d.ts +7 -0
- package/dist/es/animation/hooks/use-reduced-motion.mjs +9 -0
- package/dist/es/animation/index.d.ts +1 -0
- package/dist/es/components/reorder/index.d.ts +838 -838
- package/dist/es/features/gestures/press/index.d.ts +2 -0
- package/dist/es/features/gestures/press/index.mjs +28 -16
- package/dist/es/index.d.ts +0 -1
- package/dist/es/index.mjs +2 -3
- package/dist/es/state/motion-state.mjs +1 -1
- package/dist/nuxt/index.cjs +39 -27
- package/dist/nuxt/index.d.cts +7 -3
- package/dist/nuxt/index.d.mts +7 -3
- package/dist/nuxt/index.mjs +39 -27
- package/package.json +1 -1
- package/dist/es/constants/index.d.ts +0 -9
- package/dist/es/constants/index.mjs +0 -31
|
@@ -23,27 +23,39 @@ function handlePressEvent(state, event, lifecycle) {
|
|
|
23
23
|
}
|
|
24
24
|
class PressGesture extends Feature {
|
|
25
25
|
isActive() {
|
|
26
|
-
return Boolean(this.state.options.
|
|
26
|
+
return Boolean(this.state.options.whilePress);
|
|
27
27
|
}
|
|
28
28
|
constructor(state) {
|
|
29
29
|
super(state);
|
|
30
30
|
}
|
|
31
31
|
mount() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
this.register();
|
|
33
|
+
}
|
|
34
|
+
update() {
|
|
35
|
+
const preProps = this.state.visualElement.prevProps;
|
|
36
|
+
if (preProps.whilePress !== this.state.options.whilePress) {
|
|
37
|
+
this.register();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
register() {
|
|
41
|
+
this.unmount();
|
|
42
|
+
if (this.isActive()) {
|
|
43
|
+
const element = this.state.element;
|
|
44
|
+
if (!element)
|
|
45
|
+
return;
|
|
46
|
+
this.unmount = press(
|
|
47
|
+
element,
|
|
48
|
+
(el, startEvent) => {
|
|
49
|
+
handlePressEvent(this.state, startEvent, "Start");
|
|
50
|
+
return (endEvent, { success }) => handlePressEvent(
|
|
51
|
+
this.state,
|
|
52
|
+
endEvent,
|
|
53
|
+
success ? "End" : "Cancel"
|
|
54
|
+
);
|
|
55
|
+
},
|
|
56
|
+
{ useGlobalTarget: this.state.options.globalPressTarget }
|
|
57
|
+
);
|
|
58
|
+
}
|
|
47
59
|
}
|
|
48
60
|
}
|
|
49
61
|
export {
|
package/dist/es/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export { useLayoutGroup } from './components/use-layout-group';
|
|
|
7
7
|
export type { LayoutGroupProps } from './components/use-layout-group';
|
|
8
8
|
export * from './components/context';
|
|
9
9
|
export * from './value';
|
|
10
|
-
export * from './constants';
|
|
11
10
|
export * from './types';
|
|
12
11
|
export * from './animation';
|
|
13
12
|
export * from './utils';
|
package/dist/es/index.mjs
CHANGED
|
@@ -2,7 +2,6 @@ import { addScaleCorrector } from "./external/.pnpm/framer-motion@12.4.10/extern
|
|
|
2
2
|
import { default as default2 } from "./components/LayoutGroup.vue.mjs";
|
|
3
3
|
import { useLayoutGroup } from "./components/use-layout-group.mjs";
|
|
4
4
|
import { injectLayoutGroup, injectMotion, provideLayoutGroup, provideMotion } from "./components/context.mjs";
|
|
5
|
-
import { components, utilities } from "./constants/index.mjs";
|
|
6
5
|
import { useDragControls } from "./features/gestures/drag/use-drag-controls.mjs";
|
|
7
6
|
import { default as default3 } from "./components/motion/Motion.vue.mjs";
|
|
8
7
|
import { default as default4 } from "./components/RowValue.vue.mjs";
|
|
@@ -58,6 +57,7 @@ import { useScroll } from "./value/use-scroll.mjs";
|
|
|
58
57
|
import { useVelocity } from "./value/use-velocity.mjs";
|
|
59
58
|
import { useAnimate } from "./animation/hooks/use-animate.mjs";
|
|
60
59
|
import { useAnimationControls } from "./animation/hooks/use-animation-controls.mjs";
|
|
60
|
+
import { useReducedMotion } from "./animation/hooks/use-reduced-motion.mjs";
|
|
61
61
|
import { createContext } from "./utils/createContext.mjs";
|
|
62
62
|
import { isMotionValue } from "./utils/motion-value.mjs";
|
|
63
63
|
import { useInView } from "./utils/use-in-view.mjs";
|
|
@@ -88,7 +88,6 @@ export {
|
|
|
88
88
|
circInOut,
|
|
89
89
|
circOut,
|
|
90
90
|
clamp,
|
|
91
|
-
components,
|
|
92
91
|
createContext,
|
|
93
92
|
createScopedAnimate,
|
|
94
93
|
cubicBezier,
|
|
@@ -148,11 +147,11 @@ export {
|
|
|
148
147
|
useMotionTemplate,
|
|
149
148
|
motionValue2 as useMotionValue,
|
|
150
149
|
useMotionValueEvent,
|
|
150
|
+
useReducedMotion,
|
|
151
151
|
useScroll,
|
|
152
152
|
useSpring,
|
|
153
153
|
useTime,
|
|
154
154
|
useTransform,
|
|
155
155
|
useVelocity,
|
|
156
|
-
utilities,
|
|
157
156
|
wrap
|
|
158
157
|
};
|
|
@@ -196,7 +196,7 @@ class MotionState {
|
|
|
196
196
|
if (isAnimate) {
|
|
197
197
|
this.animateUpdates({
|
|
198
198
|
isFallback: !isActive && name !== "exit" && this.visualElement.isControllingVariants,
|
|
199
|
-
isExit: this.activeStates.exit
|
|
199
|
+
isExit: name === "exit" && this.activeStates.exit
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
202
|
}
|
package/dist/nuxt/index.cjs
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const kit = require('@nuxt/kit');
|
|
4
|
-
const motionV = require('motion-v');
|
|
5
4
|
|
|
5
|
+
const components = [
|
|
6
|
+
"Motion",
|
|
7
|
+
"AnimatePresence",
|
|
8
|
+
"LayoutGroup",
|
|
9
|
+
"MotionConfig",
|
|
10
|
+
"ReorderGroup",
|
|
11
|
+
"ReorderItem"
|
|
12
|
+
];
|
|
13
|
+
const utilities = [
|
|
14
|
+
"useTransform",
|
|
15
|
+
"useTime",
|
|
16
|
+
"useMotionTemplate",
|
|
17
|
+
"useSpring",
|
|
18
|
+
"useScroll",
|
|
19
|
+
"useMotionValue",
|
|
20
|
+
"useVelocity",
|
|
21
|
+
"useAnimate",
|
|
22
|
+
"useInView",
|
|
23
|
+
"useAnimationFrame",
|
|
24
|
+
"useMotionValueEvent",
|
|
25
|
+
"useLayoutGroup",
|
|
26
|
+
"useDragControls",
|
|
27
|
+
"useReducedMotion"
|
|
28
|
+
];
|
|
6
29
|
const index = kit.defineNuxtModule({
|
|
7
30
|
meta: {
|
|
8
31
|
name: "motion-v",
|
|
@@ -13,36 +36,25 @@ const index = kit.defineNuxtModule({
|
|
|
13
36
|
},
|
|
14
37
|
defaults: {
|
|
15
38
|
prefix: "",
|
|
16
|
-
components: true
|
|
39
|
+
components: true,
|
|
40
|
+
utilities: true
|
|
17
41
|
},
|
|
18
42
|
setup(options, _nuxtApp) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
for (const component of getComponents()) {
|
|
28
|
-
kit.addComponent({
|
|
29
|
-
name: `${options.prefix}${component}`,
|
|
30
|
-
export: component,
|
|
31
|
-
filePath: "motion-v"
|
|
43
|
+
if (options.components) {
|
|
44
|
+
components.forEach((component) => {
|
|
45
|
+
kit.addComponent({
|
|
46
|
+
name: `${options.prefix}${component}`,
|
|
47
|
+
export: component,
|
|
48
|
+
filePath: "motion-v"
|
|
49
|
+
});
|
|
32
50
|
});
|
|
33
51
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return [];
|
|
41
|
-
}
|
|
42
|
-
for (const utility of getUtilities()) {
|
|
43
|
-
kit.addImports({
|
|
44
|
-
from: "motion-v",
|
|
45
|
-
name: utility
|
|
52
|
+
if (options.utilities) {
|
|
53
|
+
utilities.forEach((utility) => {
|
|
54
|
+
kit.addImports({
|
|
55
|
+
from: "motion-v",
|
|
56
|
+
name: utility
|
|
57
|
+
});
|
|
46
58
|
});
|
|
47
59
|
}
|
|
48
60
|
}
|
package/dist/nuxt/index.d.cts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { components } from 'motion-v';
|
|
3
2
|
|
|
3
|
+
declare const components: string[];
|
|
4
|
+
declare const utilities: string[];
|
|
5
|
+
type Components = keyof typeof components;
|
|
6
|
+
type Utilities = keyof typeof utilities;
|
|
4
7
|
interface ModuleOptions {
|
|
5
|
-
components:
|
|
8
|
+
components: boolean;
|
|
9
|
+
utilities: boolean;
|
|
6
10
|
prefix: string;
|
|
7
11
|
}
|
|
8
12
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
9
13
|
|
|
10
|
-
export { type ModuleOptions, _default as default };
|
|
14
|
+
export { type Components, type ModuleOptions, type Utilities, _default as default };
|
package/dist/nuxt/index.d.mts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { components } from 'motion-v';
|
|
3
2
|
|
|
3
|
+
declare const components: string[];
|
|
4
|
+
declare const utilities: string[];
|
|
5
|
+
type Components = keyof typeof components;
|
|
6
|
+
type Utilities = keyof typeof utilities;
|
|
4
7
|
interface ModuleOptions {
|
|
5
|
-
components:
|
|
8
|
+
components: boolean;
|
|
9
|
+
utilities: boolean;
|
|
6
10
|
prefix: string;
|
|
7
11
|
}
|
|
8
12
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
9
13
|
|
|
10
|
-
export { type ModuleOptions, _default as default };
|
|
14
|
+
export { type Components, type ModuleOptions, type Utilities, _default as default };
|
package/dist/nuxt/index.mjs
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
import { defineNuxtModule, addComponent, addImports } from '@nuxt/kit';
|
|
2
|
-
import { components, utilities } from 'motion-v';
|
|
3
2
|
|
|
3
|
+
const components = [
|
|
4
|
+
"Motion",
|
|
5
|
+
"AnimatePresence",
|
|
6
|
+
"LayoutGroup",
|
|
7
|
+
"MotionConfig",
|
|
8
|
+
"ReorderGroup",
|
|
9
|
+
"ReorderItem"
|
|
10
|
+
];
|
|
11
|
+
const utilities = [
|
|
12
|
+
"useTransform",
|
|
13
|
+
"useTime",
|
|
14
|
+
"useMotionTemplate",
|
|
15
|
+
"useSpring",
|
|
16
|
+
"useScroll",
|
|
17
|
+
"useMotionValue",
|
|
18
|
+
"useVelocity",
|
|
19
|
+
"useAnimate",
|
|
20
|
+
"useInView",
|
|
21
|
+
"useAnimationFrame",
|
|
22
|
+
"useMotionValueEvent",
|
|
23
|
+
"useLayoutGroup",
|
|
24
|
+
"useDragControls",
|
|
25
|
+
"useReducedMotion"
|
|
26
|
+
];
|
|
4
27
|
const index = defineNuxtModule({
|
|
5
28
|
meta: {
|
|
6
29
|
name: "motion-v",
|
|
@@ -11,36 +34,25 @@ const index = defineNuxtModule({
|
|
|
11
34
|
},
|
|
12
35
|
defaults: {
|
|
13
36
|
prefix: "",
|
|
14
|
-
components: true
|
|
37
|
+
components: true,
|
|
38
|
+
utilities: true
|
|
15
39
|
},
|
|
16
40
|
setup(options, _nuxtApp) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
for (const component of getComponents()) {
|
|
26
|
-
addComponent({
|
|
27
|
-
name: `${options.prefix}${component}`,
|
|
28
|
-
export: component,
|
|
29
|
-
filePath: "motion-v"
|
|
41
|
+
if (options.components) {
|
|
42
|
+
components.forEach((component) => {
|
|
43
|
+
addComponent({
|
|
44
|
+
name: `${options.prefix}${component}`,
|
|
45
|
+
export: component,
|
|
46
|
+
filePath: "motion-v"
|
|
47
|
+
});
|
|
30
48
|
});
|
|
31
49
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return [];
|
|
39
|
-
}
|
|
40
|
-
for (const utility of getUtilities()) {
|
|
41
|
-
addImports({
|
|
42
|
-
from: "motion-v",
|
|
43
|
-
name: utility
|
|
50
|
+
if (options.utilities) {
|
|
51
|
+
utilities.forEach((utility) => {
|
|
52
|
+
addImports({
|
|
53
|
+
from: "motion-v",
|
|
54
|
+
name: utility
|
|
55
|
+
});
|
|
44
56
|
});
|
|
45
57
|
}
|
|
46
58
|
}
|
package/package.json
CHANGED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const components = {
|
|
2
|
-
motion: [
|
|
3
|
-
"Motion",
|
|
4
|
-
"AnimatePresence",
|
|
5
|
-
"LayoutGroup",
|
|
6
|
-
"MotionConfig",
|
|
7
|
-
"ReorderGroup",
|
|
8
|
-
"ReorderItem"
|
|
9
|
-
]
|
|
10
|
-
};
|
|
11
|
-
const utilities = {
|
|
12
|
-
utilities: [
|
|
13
|
-
"useTransform",
|
|
14
|
-
"useTime",
|
|
15
|
-
"useMotionTemplate",
|
|
16
|
-
"useSpring",
|
|
17
|
-
"useScroll",
|
|
18
|
-
"useMotionValue",
|
|
19
|
-
"useVelocity",
|
|
20
|
-
"useAnimate",
|
|
21
|
-
"useInView",
|
|
22
|
-
"useAnimationFrame",
|
|
23
|
-
"useMotionValueEvent",
|
|
24
|
-
"useLayoutGroup",
|
|
25
|
-
"useDragControls"
|
|
26
|
-
]
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
components,
|
|
30
|
-
utilities
|
|
31
|
-
};
|