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
package/dist/cjs/index.js
CHANGED
|
@@ -5518,27 +5518,39 @@ function handlePressEvent(state2, event, lifecycle) {
|
|
|
5518
5518
|
}
|
|
5519
5519
|
class PressGesture extends Feature {
|
|
5520
5520
|
isActive() {
|
|
5521
|
-
return Boolean(this.state.options.
|
|
5521
|
+
return Boolean(this.state.options.whilePress);
|
|
5522
5522
|
}
|
|
5523
5523
|
constructor(state2) {
|
|
5524
5524
|
super(state2);
|
|
5525
5525
|
}
|
|
5526
5526
|
mount() {
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
(
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5527
|
+
this.register();
|
|
5528
|
+
}
|
|
5529
|
+
update() {
|
|
5530
|
+
const preProps = this.state.visualElement.prevProps;
|
|
5531
|
+
if (preProps.whilePress !== this.state.options.whilePress) {
|
|
5532
|
+
this.register();
|
|
5533
|
+
}
|
|
5534
|
+
}
|
|
5535
|
+
register() {
|
|
5536
|
+
this.unmount();
|
|
5537
|
+
if (this.isActive()) {
|
|
5538
|
+
const element = this.state.element;
|
|
5539
|
+
if (!element)
|
|
5540
|
+
return;
|
|
5541
|
+
this.unmount = press(
|
|
5542
|
+
element,
|
|
5543
|
+
(el, startEvent) => {
|
|
5544
|
+
handlePressEvent(this.state, startEvent, "Start");
|
|
5545
|
+
return (endEvent, { success }) => handlePressEvent(
|
|
5546
|
+
this.state,
|
|
5547
|
+
endEvent,
|
|
5548
|
+
success ? "End" : "Cancel"
|
|
5549
|
+
);
|
|
5550
|
+
},
|
|
5551
|
+
{ useGlobalTarget: this.state.options.globalPressTarget }
|
|
5552
|
+
);
|
|
5553
|
+
}
|
|
5542
5554
|
}
|
|
5543
5555
|
}
|
|
5544
5556
|
function handleHoverEvent(state2, entry, lifecycle) {
|
|
@@ -8481,7 +8493,7 @@ class MotionState {
|
|
|
8481
8493
|
if (isAnimate) {
|
|
8482
8494
|
this.animateUpdates({
|
|
8483
8495
|
isFallback: !isActive && name !== "exit" && this.visualElement.isControllingVariants,
|
|
8484
|
-
isExit: this.activeStates.exit
|
|
8496
|
+
isExit: name === "exit" && this.activeStates.exit
|
|
8485
8497
|
});
|
|
8486
8498
|
}
|
|
8487
8499
|
}
|
|
@@ -9586,33 +9598,6 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
9586
9598
|
};
|
|
9587
9599
|
}
|
|
9588
9600
|
});
|
|
9589
|
-
const components = {
|
|
9590
|
-
motion: [
|
|
9591
|
-
"Motion",
|
|
9592
|
-
"AnimatePresence",
|
|
9593
|
-
"LayoutGroup",
|
|
9594
|
-
"MotionConfig",
|
|
9595
|
-
"ReorderGroup",
|
|
9596
|
-
"ReorderItem"
|
|
9597
|
-
]
|
|
9598
|
-
};
|
|
9599
|
-
const utilities = {
|
|
9600
|
-
utilities: [
|
|
9601
|
-
"useTransform",
|
|
9602
|
-
"useTime",
|
|
9603
|
-
"useMotionTemplate",
|
|
9604
|
-
"useSpring",
|
|
9605
|
-
"useScroll",
|
|
9606
|
-
"useMotionValue",
|
|
9607
|
-
"useVelocity",
|
|
9608
|
-
"useAnimate",
|
|
9609
|
-
"useInView",
|
|
9610
|
-
"useAnimationFrame",
|
|
9611
|
-
"useMotionValueEvent",
|
|
9612
|
-
"useLayoutGroup",
|
|
9613
|
-
"useDragControls"
|
|
9614
|
-
]
|
|
9615
|
-
};
|
|
9616
9601
|
function useAnimate() {
|
|
9617
9602
|
const dom = vue.ref(null);
|
|
9618
9603
|
const domProxy = new Proxy(dom, {
|
|
@@ -9733,6 +9718,10 @@ function useAnimationControls() {
|
|
|
9733
9718
|
});
|
|
9734
9719
|
return controls;
|
|
9735
9720
|
}
|
|
9721
|
+
function useReducedMotion(options = {}) {
|
|
9722
|
+
const reducedMotion = core.useMediaQuery("(prefers-reduced-motion: reduce)", options);
|
|
9723
|
+
return vue.computed(() => reducedMotion.value);
|
|
9724
|
+
}
|
|
9736
9725
|
class DragControls {
|
|
9737
9726
|
constructor() {
|
|
9738
9727
|
this.componentControls = /* @__PURE__ */ new Set();
|
|
@@ -9794,7 +9783,6 @@ exports.circIn = circIn;
|
|
|
9794
9783
|
exports.circInOut = circInOut;
|
|
9795
9784
|
exports.circOut = circOut;
|
|
9796
9785
|
exports.clamp = clamp$1;
|
|
9797
|
-
exports.components = components;
|
|
9798
9786
|
exports.createContext = createContext;
|
|
9799
9787
|
exports.createScopedAnimate = createScopedAnimate;
|
|
9800
9788
|
exports.cubicBezier = cubicBezier;
|
|
@@ -9853,10 +9841,10 @@ exports.useMotionConfig = useMotionConfig;
|
|
|
9853
9841
|
exports.useMotionTemplate = useMotionTemplate;
|
|
9854
9842
|
exports.useMotionValue = motionValue;
|
|
9855
9843
|
exports.useMotionValueEvent = useMotionValueEvent;
|
|
9844
|
+
exports.useReducedMotion = useReducedMotion;
|
|
9856
9845
|
exports.useScroll = useScroll;
|
|
9857
9846
|
exports.useSpring = useSpring;
|
|
9858
9847
|
exports.useTime = useTime;
|
|
9859
9848
|
exports.useTransform = useTransform;
|
|
9860
9849
|
exports.useVelocity = useVelocity;
|
|
9861
|
-
exports.utilities = utilities;
|
|
9862
9850
|
exports.wrap = wrap;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { useMediaQuery } from "@vueuse/core";
|
|
3
|
+
function useReducedMotion(options = {}) {
|
|
4
|
+
const reducedMotion = useMediaQuery("(prefers-reduced-motion: reduce)", options);
|
|
5
|
+
return computed(() => reducedMotion.value);
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
useReducedMotion
|
|
9
|
+
};
|