motion-v 0.11.0-beta.5 → 0.11.0-beta.6
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 +23 -5
- package/dist/es/components/hooks/use-motion-elm.mjs +9 -0
- package/dist/es/components/motion/Motion.vue.mjs +2 -1
- package/dist/es/components/motion/utils.d.ts +0 -1
- package/dist/es/components/motion/utils.mjs +2 -7
- package/dist/es/index.mjs +2 -0
- package/dist/es/types/state.d.ts +2 -1
- package/dist/es/utils/index.d.ts +1 -0
- package/dist/es/utils/use-dom-ref.d.ts +1 -1
- package/dist/es/utils/use-dom-ref.mjs +22 -0
- package/package.json +1 -1
- package/dist/es/shared/index.d.ts +0 -0
package/dist/cjs/index.js
CHANGED
|
@@ -4984,6 +4984,28 @@ function millisecondsToSeconds(milliseconds) {
|
|
|
4984
4984
|
function getContextWindow({ current }) {
|
|
4985
4985
|
return current ? current.ownerDocument.defaultView : null;
|
|
4986
4986
|
}
|
|
4987
|
+
function getMotionElement(el) {
|
|
4988
|
+
if ((el == null ? void 0 : el.nodeType) === 3 || (el == null ? void 0 : el.nodeType) === 8)
|
|
4989
|
+
return getMotionElement(el.nextSibling);
|
|
4990
|
+
return el;
|
|
4991
|
+
}
|
|
4992
|
+
function useDomRef() {
|
|
4993
|
+
const dom = vue.ref(null);
|
|
4994
|
+
const domProxy = new Proxy(dom, {
|
|
4995
|
+
get(target, key) {
|
|
4996
|
+
if (typeof key === "string" || typeof key === "symbol") {
|
|
4997
|
+
return Reflect.get(target, key);
|
|
4998
|
+
}
|
|
4999
|
+
return void 0;
|
|
5000
|
+
},
|
|
5001
|
+
set(target, key, value) {
|
|
5002
|
+
if (key === "value")
|
|
5003
|
+
return Reflect.set(target, key, getMotionElement((value == null ? void 0 : value.$el) || value));
|
|
5004
|
+
return true;
|
|
5005
|
+
}
|
|
5006
|
+
});
|
|
5007
|
+
return domProxy;
|
|
5008
|
+
}
|
|
4987
5009
|
const [injectMotion, provideMotion] = createContext("Motion");
|
|
4988
5010
|
const [injectLayoutGroup, provideLayoutGroup] = createContext("LayoutGroup");
|
|
4989
5011
|
function resolveVariant(definition, variants, custom) {
|
|
@@ -8400,11 +8422,6 @@ class MotionState {
|
|
|
8400
8422
|
}
|
|
8401
8423
|
}
|
|
8402
8424
|
}
|
|
8403
|
-
function getMotionElement(el) {
|
|
8404
|
-
if ((el == null ? void 0 : el.nodeType) === 3 || (el == null ? void 0 : el.nodeType) === 8)
|
|
8405
|
-
return getMotionElement(el.nextSibling);
|
|
8406
|
-
return el;
|
|
8407
|
-
}
|
|
8408
8425
|
function checkMotionIsHidden(instance) {
|
|
8409
8426
|
var _a;
|
|
8410
8427
|
const isHidden = ((_a = getMotionElement(instance.$el)) == null ? void 0 : _a.style.display) === "none";
|
|
@@ -9686,6 +9703,7 @@ exports.useAnimationControls = useAnimationControls;
|
|
|
9686
9703
|
exports.useAnimationFrame = useAnimationFrame;
|
|
9687
9704
|
exports.useCombineMotionValues = useCombineMotionValues;
|
|
9688
9705
|
exports.useComputed = useComputed;
|
|
9706
|
+
exports.useDomRef = useDomRef;
|
|
9689
9707
|
exports.useDragControls = useDragControls;
|
|
9690
9708
|
exports.useInView = useInView;
|
|
9691
9709
|
exports.useLayoutGroup = useLayoutGroup;
|
|
@@ -4,8 +4,9 @@ import { convertSvgStyleToAttributes, createStyles } from "../../state/style.mjs
|
|
|
4
4
|
import { Primitive } from "./Primitive.mjs";
|
|
5
5
|
import { MotionState } from "../../state/motion-state.mjs";
|
|
6
6
|
import { injectAnimatePresence } from "../presence.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { checkMotionIsHidden } from "./utils.mjs";
|
|
8
8
|
import { useMotionConfig } from "../motion-config/context.mjs";
|
|
9
|
+
import { getMotionElement } from "../hooks/use-motion-elm.mjs";
|
|
9
10
|
import { isMotionValue } from "../../utils/motion-value.mjs";
|
|
10
11
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
12
|
...{
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
if ((el == null ? void 0 : el.nodeType) === 3 || (el == null ? void 0 : el.nodeType) === 8)
|
|
3
|
-
return getMotionElement(el.nextSibling);
|
|
4
|
-
return el;
|
|
5
|
-
}
|
|
1
|
+
import { getMotionElement } from "../hooks/use-motion-elm.mjs";
|
|
6
2
|
function checkMotionIsHidden(instance) {
|
|
7
3
|
var _a;
|
|
8
4
|
const isHidden = ((_a = getMotionElement(instance.$el)) == null ? void 0 : _a.style.display) === "none";
|
|
@@ -10,6 +6,5 @@ function checkMotionIsHidden(instance) {
|
|
|
10
6
|
return hasTransition && isHidden;
|
|
11
7
|
}
|
|
12
8
|
export {
|
|
13
|
-
checkMotionIsHidden
|
|
14
|
-
getMotionElement
|
|
9
|
+
checkMotionIsHidden
|
|
15
10
|
};
|
package/dist/es/index.mjs
CHANGED
|
@@ -62,6 +62,7 @@ import { useInView } from "./utils/use-in-view.mjs";
|
|
|
62
62
|
import { useAnimationFrame } from "./utils/use-animation-frame.mjs";
|
|
63
63
|
import { millisecondsToSeconds, secondsToMilliseconds } from "./utils/time-conversion.mjs";
|
|
64
64
|
import { getContextWindow } from "./utils/get-context-window.mjs";
|
|
65
|
+
import { useDomRef } from "./utils/use-dom-ref.mjs";
|
|
65
66
|
export {
|
|
66
67
|
default5 as AnimatePresence,
|
|
67
68
|
default2 as LayoutGroup,
|
|
@@ -135,6 +136,7 @@ export {
|
|
|
135
136
|
useAnimationFrame,
|
|
136
137
|
useCombineMotionValues,
|
|
137
138
|
useComputed,
|
|
139
|
+
useDomRef,
|
|
138
140
|
useDragControls,
|
|
139
141
|
useInView,
|
|
140
142
|
useLayoutGroup,
|
package/dist/es/types/state.d.ts
CHANGED
|
@@ -32,8 +32,9 @@ export interface DragOptions {
|
|
|
32
32
|
constraints?: false | Partial<BoundingBox>;
|
|
33
33
|
dragSnapToOrigin?: boolean;
|
|
34
34
|
}
|
|
35
|
+
type TransformPropertiesWithoutTransition = Omit<TransformProperties, 'transition'>;
|
|
35
36
|
export type MotionStyle = Partial<{
|
|
36
|
-
[K in keyof (Variant &
|
|
37
|
+
[K in keyof (Variant & TransformPropertiesWithoutTransition)]: string | number | undefined | MotionValue;
|
|
37
38
|
}>;
|
|
38
39
|
export type ElementType = keyof IntrinsicElementAttributes;
|
|
39
40
|
export interface Options<T = any> extends LayoutOptions, PressProps, HoverProps, InViewProps, DragProps, PanProps, FocusProps {
|
package/dist/es/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useDomRef
|
|
1
|
+
export declare function useDomRef(): import('vue').Ref<any>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getMotionElement } from "../components/hooks/use-motion-elm.mjs";
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
function useDomRef() {
|
|
4
|
+
const dom = ref(null);
|
|
5
|
+
const domProxy = new Proxy(dom, {
|
|
6
|
+
get(target, key) {
|
|
7
|
+
if (typeof key === "string" || typeof key === "symbol") {
|
|
8
|
+
return Reflect.get(target, key);
|
|
9
|
+
}
|
|
10
|
+
return void 0;
|
|
11
|
+
},
|
|
12
|
+
set(target, key, value) {
|
|
13
|
+
if (key === "value")
|
|
14
|
+
return Reflect.set(target, key, getMotionElement((value == null ? void 0 : value.$el) || value));
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return domProxy;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
useDomRef
|
|
22
|
+
};
|
package/package.json
CHANGED
|
File without changes
|