motion-v 0.10.0 → 0.11.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 +17 -15
- package/dist/es/components/LayoutGroup.d.ts +15 -1
- package/dist/es/components/LayoutGroup.vue.mjs +1 -1
- package/dist/es/components/animate-presence/AnimatePresence.d.ts +3 -0
- package/dist/es/components/animate-presence/AnimatePresence.vue.mjs +5 -6
- package/dist/es/components/animate-presence/types.d.ts +1 -0
- package/dist/es/components/animate-presence/use-pop-layout.mjs +10 -9
- package/dist/es/components/index.d.ts +1 -0
- package/dist/es/index.d.ts +1 -0
- package/dist/es/index.mjs +4 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -8654,12 +8654,17 @@ function usePopLayout(props) {
|
|
|
8654
8654
|
function addPopStyle(state2) {
|
|
8655
8655
|
if (props.mode !== "popLayout")
|
|
8656
8656
|
return;
|
|
8657
|
+
const parent = state2.element.offsetParent;
|
|
8658
|
+
const parentWidth = parent instanceof HTMLElement ? parent.offsetWidth || 0 : 0;
|
|
8657
8659
|
const size = {
|
|
8658
8660
|
height: state2.element.offsetHeight || 0,
|
|
8659
8661
|
width: state2.element.offsetWidth || 0,
|
|
8660
8662
|
top: state2.element.offsetTop,
|
|
8661
|
-
left: state2.element.offsetLeft
|
|
8663
|
+
left: state2.element.offsetLeft,
|
|
8664
|
+
right: 0
|
|
8662
8665
|
};
|
|
8666
|
+
size.right = parentWidth - size.width - size.left;
|
|
8667
|
+
const x = props.anchorX === "left" ? `left: ${size.left}` : `right: ${size.right}`;
|
|
8663
8668
|
state2.element.dataset.motionPopId = state2.id;
|
|
8664
8669
|
const style2 = document.createElement("style");
|
|
8665
8670
|
if (config.value.nonce) {
|
|
@@ -8667,11 +8672,6 @@ function usePopLayout(props) {
|
|
|
8667
8672
|
}
|
|
8668
8673
|
styles.set(state2, style2);
|
|
8669
8674
|
document.head.appendChild(style2);
|
|
8670
|
-
style2.textContent = `
|
|
8671
|
-
[data-motion-pop-id="${state2.id}"] {
|
|
8672
|
-
animation: pop 0.3s ease-in-out;
|
|
8673
|
-
}
|
|
8674
|
-
`;
|
|
8675
8675
|
if (style2.sheet) {
|
|
8676
8676
|
style2.sheet.insertRule(`
|
|
8677
8677
|
[data-motion-pop-id="${state2.id}"] {
|
|
@@ -8679,8 +8679,8 @@ function usePopLayout(props) {
|
|
|
8679
8679
|
width: ${size.width}px !important;
|
|
8680
8680
|
height: ${size.height}px !important;
|
|
8681
8681
|
top: ${size.top}px !important;
|
|
8682
|
-
|
|
8683
|
-
|
|
8682
|
+
${x}px !important;
|
|
8683
|
+
}
|
|
8684
8684
|
`);
|
|
8685
8685
|
}
|
|
8686
8686
|
}
|
|
@@ -8689,7 +8689,7 @@ function usePopLayout(props) {
|
|
|
8689
8689
|
if (!style2)
|
|
8690
8690
|
return;
|
|
8691
8691
|
styles.delete(state2);
|
|
8692
|
-
|
|
8692
|
+
frame.render(() => {
|
|
8693
8693
|
document.head.removeChild(style2);
|
|
8694
8694
|
});
|
|
8695
8695
|
}
|
|
@@ -8712,7 +8712,8 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8712
8712
|
as: {},
|
|
8713
8713
|
custom: {},
|
|
8714
8714
|
onExitComplete: {},
|
|
8715
|
-
unwrapElement: { type: Boolean, default: false }
|
|
8715
|
+
unwrapElement: { type: Boolean, default: false },
|
|
8716
|
+
anchorX: { default: "left" }
|
|
8716
8717
|
},
|
|
8717
8718
|
setup(__props) {
|
|
8718
8719
|
const props = __props;
|
|
@@ -8724,16 +8725,17 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8724
8725
|
vue.onMounted(() => {
|
|
8725
8726
|
presenceContext.initial = void 0;
|
|
8726
8727
|
});
|
|
8728
|
+
const { addPopStyle, removePopStyle, styles } = usePopLayout(props);
|
|
8727
8729
|
function enter(el) {
|
|
8728
8730
|
const state2 = mountedStates.get(el);
|
|
8729
8731
|
if (!state2) {
|
|
8730
8732
|
return;
|
|
8731
8733
|
}
|
|
8734
|
+
removePopStyle(state2);
|
|
8732
8735
|
state2.isVShow = true;
|
|
8733
8736
|
removeDoneCallback(el);
|
|
8734
8737
|
state2.setActive("exit", false);
|
|
8735
8738
|
}
|
|
8736
|
-
const { addPopStyle, removePopStyle, styles } = usePopLayout(props);
|
|
8737
8739
|
const exitDom = /* @__PURE__ */ new Map();
|
|
8738
8740
|
vue.onUnmounted(() => {
|
|
8739
8741
|
exitDom.clear();
|
|
@@ -8765,9 +8767,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8765
8767
|
if (!styles.has(state2)) {
|
|
8766
8768
|
state2.willUpdate("done");
|
|
8767
8769
|
} else {
|
|
8768
|
-
|
|
8769
|
-
removePopStyle(state2);
|
|
8770
|
-
});
|
|
8770
|
+
removePopStyle(state2);
|
|
8771
8771
|
}
|
|
8772
8772
|
done();
|
|
8773
8773
|
if (!(el == null ? void 0 : el.isConnected)) {
|
|
@@ -9405,7 +9405,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
9405
9405
|
__name: "LayoutGroup",
|
|
9406
9406
|
props: {
|
|
9407
9407
|
id: {},
|
|
9408
|
-
inherit: { type: [Boolean, String] }
|
|
9408
|
+
inherit: { type: [Boolean, String], default: true }
|
|
9409
9409
|
},
|
|
9410
9410
|
setup(__props) {
|
|
9411
9411
|
const props = __props;
|
|
@@ -9611,6 +9611,7 @@ exports.Reorder = Reorder;
|
|
|
9611
9611
|
exports.ReorderGroup = ReorderGroup;
|
|
9612
9612
|
exports.ReorderItem = ReorderItem;
|
|
9613
9613
|
exports.RowValue = _sfc_main$1;
|
|
9614
|
+
exports.addScaleCorrector = addScaleCorrector;
|
|
9614
9615
|
exports.animate = animate;
|
|
9615
9616
|
exports.animateMini = animateMini;
|
|
9616
9617
|
exports.anticipate = anticipate;
|
|
@@ -9650,6 +9651,7 @@ exports.mirrorEasing = mirrorEasing;
|
|
|
9650
9651
|
exports.mix = mix;
|
|
9651
9652
|
exports.motion = motion;
|
|
9652
9653
|
exports.motionValue = motionValue;
|
|
9654
|
+
exports.mountedStates = mountedStates;
|
|
9653
9655
|
exports.noop = noop;
|
|
9654
9656
|
exports.pipe = pipe;
|
|
9655
9657
|
exports.progress = progress$1;
|
|
@@ -10,9 +10,20 @@ declare function __VLS_template(): {
|
|
|
10
10
|
attrs: Partial<{}>;
|
|
11
11
|
};
|
|
12
12
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
13
|
-
declare const __VLS_component: import('vue').DefineComponent<__VLS_TypePropsToOption<LayoutGroupProps>, {
|
|
13
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<LayoutGroupProps>, {
|
|
14
|
+
inherit: boolean;
|
|
15
|
+
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<LayoutGroupProps>, {
|
|
16
|
+
inherit: boolean;
|
|
17
|
+
}>>>, {
|
|
18
|
+
inherit: boolean | "id" | "group";
|
|
19
|
+
}, {}>;
|
|
14
20
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
15
21
|
export default _default;
|
|
22
|
+
type __VLS_WithDefaults<P, D> = {
|
|
23
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
24
|
+
default: D[K];
|
|
25
|
+
}> : P[K];
|
|
26
|
+
};
|
|
16
27
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
17
28
|
type __VLS_TypePropsToOption<T> = {
|
|
18
29
|
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
@@ -27,3 +38,6 @@ type __VLS_WithTemplateSlots<T, S> = T & {
|
|
|
27
38
|
$slots: S;
|
|
28
39
|
};
|
|
29
40
|
};
|
|
41
|
+
type __VLS_PrettifyLocal<T> = {
|
|
42
|
+
[K in keyof T]: T[K];
|
|
43
|
+
} & {};
|
|
@@ -12,16 +12,19 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_WithDefaults<
|
|
|
12
12
|
initial: boolean;
|
|
13
13
|
multiple: boolean;
|
|
14
14
|
unwrapElement: boolean;
|
|
15
|
+
anchorX: string;
|
|
15
16
|
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<AnimatePresenceProps>, {
|
|
16
17
|
mode: string;
|
|
17
18
|
initial: boolean;
|
|
18
19
|
multiple: boolean;
|
|
19
20
|
unwrapElement: boolean;
|
|
21
|
+
anchorX: string;
|
|
20
22
|
}>>>, {
|
|
21
23
|
initial: boolean;
|
|
22
24
|
mode: "wait" | "popLayout" | "sync";
|
|
23
25
|
multiple: boolean;
|
|
24
26
|
unwrapElement: boolean;
|
|
27
|
+
anchorX: "left" | "right";
|
|
25
28
|
}, {}>;
|
|
26
29
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
27
30
|
export default _default;
|
|
@@ -2,7 +2,6 @@ import { defineComponent, onMounted, onUnmounted, computed, openBlock, createBlo
|
|
|
2
2
|
import { mountedStates } from "../../state/motion-state.mjs";
|
|
3
3
|
import { provideAnimatePresence, removeDoneCallback, doneCallbacks } from "../presence.mjs";
|
|
4
4
|
import { usePopLayout } from "./use-pop-layout.mjs";
|
|
5
|
-
import { frame } from "../../external/.pnpm/framer-motion@11.16.6/external/framer-motion/dist/es/frameloop/frame.mjs";
|
|
6
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
6
|
...{
|
|
8
7
|
name: "AnimatePresence",
|
|
@@ -16,7 +15,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
16
15
|
as: {},
|
|
17
16
|
custom: {},
|
|
18
17
|
onExitComplete: {},
|
|
19
|
-
unwrapElement: { type: Boolean, default: false }
|
|
18
|
+
unwrapElement: { type: Boolean, default: false },
|
|
19
|
+
anchorX: { default: "left" }
|
|
20
20
|
},
|
|
21
21
|
setup(__props) {
|
|
22
22
|
const props = __props;
|
|
@@ -28,16 +28,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
28
28
|
onMounted(() => {
|
|
29
29
|
presenceContext.initial = void 0;
|
|
30
30
|
});
|
|
31
|
+
const { addPopStyle, removePopStyle, styles } = usePopLayout(props);
|
|
31
32
|
function enter(el) {
|
|
32
33
|
const state = mountedStates.get(el);
|
|
33
34
|
if (!state) {
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
37
|
+
removePopStyle(state);
|
|
36
38
|
state.isVShow = true;
|
|
37
39
|
removeDoneCallback(el);
|
|
38
40
|
state.setActive("exit", false);
|
|
39
41
|
}
|
|
40
|
-
const { addPopStyle, removePopStyle, styles } = usePopLayout(props);
|
|
41
42
|
const exitDom = /* @__PURE__ */ new Map();
|
|
42
43
|
onUnmounted(() => {
|
|
43
44
|
exitDom.clear();
|
|
@@ -69,9 +70,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
69
70
|
if (!styles.has(state)) {
|
|
70
71
|
state.willUpdate("done");
|
|
71
72
|
} else {
|
|
72
|
-
|
|
73
|
-
removePopStyle(state);
|
|
74
|
-
});
|
|
73
|
+
removePopStyle(state);
|
|
75
74
|
}
|
|
76
75
|
done();
|
|
77
76
|
if (!(el == null ? void 0 : el.isConnected)) {
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { useMotionConfig } from "../motion-config/context.mjs";
|
|
2
|
+
import { frame } from "../../external/.pnpm/framer-motion@11.16.6/external/framer-motion/dist/es/frameloop/frame.mjs";
|
|
2
3
|
function usePopLayout(props) {
|
|
3
4
|
const styles = /* @__PURE__ */ new WeakMap();
|
|
4
5
|
const config = useMotionConfig();
|
|
5
6
|
function addPopStyle(state) {
|
|
6
7
|
if (props.mode !== "popLayout")
|
|
7
8
|
return;
|
|
9
|
+
const parent = state.element.offsetParent;
|
|
10
|
+
const parentWidth = parent instanceof HTMLElement ? parent.offsetWidth || 0 : 0;
|
|
8
11
|
const size = {
|
|
9
12
|
height: state.element.offsetHeight || 0,
|
|
10
13
|
width: state.element.offsetWidth || 0,
|
|
11
14
|
top: state.element.offsetTop,
|
|
12
|
-
left: state.element.offsetLeft
|
|
15
|
+
left: state.element.offsetLeft,
|
|
16
|
+
right: 0
|
|
13
17
|
};
|
|
18
|
+
size.right = parentWidth - size.width - size.left;
|
|
19
|
+
const x = props.anchorX === "left" ? `left: ${size.left}` : `right: ${size.right}`;
|
|
14
20
|
state.element.dataset.motionPopId = state.id;
|
|
15
21
|
const style = document.createElement("style");
|
|
16
22
|
if (config.value.nonce) {
|
|
@@ -18,11 +24,6 @@ function usePopLayout(props) {
|
|
|
18
24
|
}
|
|
19
25
|
styles.set(state, style);
|
|
20
26
|
document.head.appendChild(style);
|
|
21
|
-
style.textContent = `
|
|
22
|
-
[data-motion-pop-id="${state.id}"] {
|
|
23
|
-
animation: pop 0.3s ease-in-out;
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
26
27
|
if (style.sheet) {
|
|
27
28
|
style.sheet.insertRule(`
|
|
28
29
|
[data-motion-pop-id="${state.id}"] {
|
|
@@ -30,8 +31,8 @@ function usePopLayout(props) {
|
|
|
30
31
|
width: ${size.width}px !important;
|
|
31
32
|
height: ${size.height}px !important;
|
|
32
33
|
top: ${size.top}px !important;
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
${x}px !important;
|
|
35
|
+
}
|
|
35
36
|
`);
|
|
36
37
|
}
|
|
37
38
|
}
|
|
@@ -40,7 +41,7 @@ function usePopLayout(props) {
|
|
|
40
41
|
if (!style)
|
|
41
42
|
return;
|
|
42
43
|
styles.delete(state);
|
|
43
|
-
|
|
44
|
+
frame.render(() => {
|
|
44
45
|
document.head.removeChild(style);
|
|
45
46
|
});
|
|
46
47
|
}
|
package/dist/es/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from 'framer-motion/dom';
|
|
2
|
+
export { addScaleCorrector } from '../node_modules/framer-motion/dist/es/projection/styles/scale-correction.mjs';
|
|
2
3
|
export { motionValue as useMotionValue } from 'framer-motion/dom';
|
|
3
4
|
export * from './components';
|
|
4
5
|
export { default as LayoutGroup } from './components/LayoutGroup';
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { addScaleCorrector } from "./external/.pnpm/framer-motion@11.16.6/external/framer-motion/dist/es/projection/styles/scale-correction.mjs";
|
|
1
2
|
import { default as default2 } from "./components/LayoutGroup.vue.mjs";
|
|
2
3
|
import { useLayoutGroup } from "./components/use-layout-group.mjs";
|
|
3
4
|
import { injectLayoutGroup, injectMotion, provideLayoutGroup, provideMotion } from "./components/context.mjs";
|
|
@@ -41,6 +42,7 @@ import { wrap } from "./external/.pnpm/framer-motion@11.16.6/external/framer-mot
|
|
|
41
42
|
import { cancelSync, sync } from "./external/.pnpm/framer-motion@11.16.6/external/framer-motion/dist/es/frameloop/index-legacy.mjs";
|
|
42
43
|
import { cancelFrame, frame, frameData, frameSteps } from "./external/.pnpm/framer-motion@11.16.6/external/framer-motion/dist/es/frameloop/frame.mjs";
|
|
43
44
|
import { motion } from "./components/motion/NameSpace.mjs";
|
|
45
|
+
import { mountedStates } from "./state/motion-state.mjs";
|
|
44
46
|
import { provideMotionConfig, useMotionConfig } from "./components/motion-config/context.mjs";
|
|
45
47
|
import { Reorder, ReorderGroup, ReorderItem } from "./components/reorder/index.mjs";
|
|
46
48
|
import { useComputed } from "./value/use-computed.mjs";
|
|
@@ -70,6 +72,7 @@ export {
|
|
|
70
72
|
ReorderGroup,
|
|
71
73
|
ReorderItem,
|
|
72
74
|
default4 as RowValue,
|
|
75
|
+
addScaleCorrector,
|
|
73
76
|
animate,
|
|
74
77
|
animateMini,
|
|
75
78
|
anticipate,
|
|
@@ -110,6 +113,7 @@ export {
|
|
|
110
113
|
mix,
|
|
111
114
|
motion,
|
|
112
115
|
motionValue,
|
|
116
|
+
mountedStates,
|
|
113
117
|
noop,
|
|
114
118
|
pipe,
|
|
115
119
|
progress,
|