motion-v 0.6.1 → 0.6.2
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 +14 -7
- package/dist/es/components/animate-presence/AnimatePresence.vue.mjs +14 -7
- package/dist/es/state/motion-state.mjs +1 -1
- package/dist/src/components/LayoutGroup.d.ts +10 -1
- package/dist/src/components/Motion.d.ts +1 -1
- package/dist/src/components/Primitive.d.ts +5 -5
- package/dist/src/components/Slot.d.ts +1 -1
- package/dist/src/components/animate-presence/AnimatePresence.d.ts +27 -2
- package/dist/src/components/motion-config/MotionConfig.d.ts +23 -2
- package/dist/src/shared/test.d.ts +1 -0
- package/dist/src/utils/use-dom-ref.d.ts +1 -2
- package/dist/src/utils/use-in-view.d.ts +1 -1
- package/package.json +1 -1
- package/dist/src/utils/events.d.ts +0 -2
package/dist/cjs/index.js
CHANGED
|
@@ -8212,7 +8212,7 @@ class MotionState {
|
|
|
8212
8212
|
return;
|
|
8213
8213
|
this.activeStates[name] = isActive;
|
|
8214
8214
|
(_a = this.visualElement.variantChildren) == null ? void 0 : _a.forEach((child) => {
|
|
8215
|
-
child.state.setActive(name, isActive,
|
|
8215
|
+
child.state.setActive(name, isActive, !isActive);
|
|
8216
8216
|
});
|
|
8217
8217
|
if (isAnimate) {
|
|
8218
8218
|
this.animateUpdates();
|
|
@@ -8662,19 +8662,26 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8662
8662
|
el.addEventListener("motioncomplete", doneCallback);
|
|
8663
8663
|
state2.setActive("exit", true);
|
|
8664
8664
|
}
|
|
8665
|
+
const transitionProps = vue.computed(() => {
|
|
8666
|
+
if (props.multiple) {
|
|
8667
|
+
return {
|
|
8668
|
+
tag: props.as
|
|
8669
|
+
};
|
|
8670
|
+
}
|
|
8671
|
+
return {
|
|
8672
|
+
mode: props.mode === "wait" ? "out-in" : void 0
|
|
8673
|
+
};
|
|
8674
|
+
});
|
|
8665
8675
|
return (_ctx, _cache) => {
|
|
8666
|
-
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.multiple ? vue.TransitionGroup : vue.Transition), {
|
|
8667
|
-
tag: _ctx.multiple ? _ctx.as : void 0,
|
|
8668
|
-
css: false,
|
|
8669
|
-
mode: _ctx.mode === "wait" ? "out-in" : void 0,
|
|
8676
|
+
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.multiple ? vue.TransitionGroup : vue.Transition), vue.mergeProps({ css: false }, transitionProps.value, {
|
|
8670
8677
|
onEnter: enter,
|
|
8671
8678
|
onLeave: exit
|
|
8672
|
-
}, {
|
|
8679
|
+
}), {
|
|
8673
8680
|
default: vue.withCtx(() => [
|
|
8674
8681
|
vue.renderSlot(_ctx.$slots, "default")
|
|
8675
8682
|
]),
|
|
8676
8683
|
_: 3
|
|
8677
|
-
},
|
|
8684
|
+
}, 16);
|
|
8678
8685
|
};
|
|
8679
8686
|
}
|
|
8680
8687
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, onMounted, onUnmounted, openBlock, createBlock, resolveDynamicComponent, TransitionGroup, Transition, withCtx, renderSlot } from "vue";
|
|
1
|
+
import { defineComponent, onMounted, onUnmounted, computed, openBlock, createBlock, resolveDynamicComponent, TransitionGroup, Transition, mergeProps, withCtx, renderSlot } from "vue";
|
|
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";
|
|
@@ -74,19 +74,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
74
74
|
el.addEventListener("motioncomplete", doneCallback);
|
|
75
75
|
state.setActive("exit", true);
|
|
76
76
|
}
|
|
77
|
+
const transitionProps = computed(() => {
|
|
78
|
+
if (props.multiple) {
|
|
79
|
+
return {
|
|
80
|
+
tag: props.as
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
mode: props.mode === "wait" ? "out-in" : void 0
|
|
85
|
+
};
|
|
86
|
+
});
|
|
77
87
|
return (_ctx, _cache) => {
|
|
78
|
-
return openBlock(), createBlock(resolveDynamicComponent(_ctx.multiple ? TransitionGroup : Transition), {
|
|
79
|
-
tag: _ctx.multiple ? _ctx.as : void 0,
|
|
80
|
-
css: false,
|
|
81
|
-
mode: _ctx.mode === "wait" ? "out-in" : void 0,
|
|
88
|
+
return openBlock(), createBlock(resolveDynamicComponent(_ctx.multiple ? TransitionGroup : Transition), mergeProps({ css: false }, transitionProps.value, {
|
|
82
89
|
onEnter: enter,
|
|
83
90
|
onLeave: exit
|
|
84
|
-
}, {
|
|
91
|
+
}), {
|
|
85
92
|
default: withCtx(() => [
|
|
86
93
|
renderSlot(_ctx.$slots, "default")
|
|
87
94
|
]),
|
|
88
95
|
_: 3
|
|
89
|
-
},
|
|
96
|
+
}, 16);
|
|
90
97
|
};
|
|
91
98
|
}
|
|
92
99
|
});
|
|
@@ -166,7 +166,7 @@ class MotionState {
|
|
|
166
166
|
return;
|
|
167
167
|
this.activeStates[name] = isActive;
|
|
168
168
|
(_a = this.visualElement.variantChildren) == null ? void 0 : _a.forEach((child) => {
|
|
169
|
-
child.state.setActive(name, isActive,
|
|
169
|
+
child.state.setActive(name, isActive, !isActive);
|
|
170
170
|
});
|
|
171
171
|
if (isAnimate) {
|
|
172
172
|
this.animateUpdates();
|
|
@@ -10,9 +10,18 @@ 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<LayoutGroupProps
|
|
13
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_TypePropsToOption<LayoutGroupProps>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<LayoutGroupProps>>>, {}, {}>;
|
|
14
14
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
15
15
|
export default _default;
|
|
16
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
17
|
+
type __VLS_TypePropsToOption<T> = {
|
|
18
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
19
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
20
|
+
} : {
|
|
21
|
+
type: import('vue').PropType<T[K]>;
|
|
22
|
+
required: true;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
16
25
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
17
26
|
new (): {
|
|
18
27
|
$slots: S;
|
|
@@ -6,7 +6,7 @@ export interface MotionProps<T extends ElementType = 'div', K = unknown> extends
|
|
|
6
6
|
whileDrag?: Options['whileDrag'];
|
|
7
7
|
}
|
|
8
8
|
declare const _default: <T extends ElementType = "div", K = unknown>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
9
|
-
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps
|
|
9
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<import('vue').ExtractPropTypes<{}>>, never>, never> & (Omit<SetMotionValueType<IntrinsicElementAttributes, keyof SVGAttributesWithMotionValues>[T], "asChild" | keyof Options<any>> & MotionProps<T, K>)> & import('vue').PublicProps;
|
|
10
10
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
11
11
|
attrs: any;
|
|
12
12
|
slots: {
|
|
@@ -13,7 +13,7 @@ export interface PrimitiveProps {
|
|
|
13
13
|
*/
|
|
14
14
|
as?: AsTag | Component;
|
|
15
15
|
}
|
|
16
|
-
export declare const Primitive: import('vue').DefineComponent<
|
|
16
|
+
export declare const Primitive: import('vue').DefineComponent<{
|
|
17
17
|
asChild: {
|
|
18
18
|
type: BooleanConstructor;
|
|
19
19
|
default: boolean;
|
|
@@ -26,9 +26,9 @@ export declare const Primitive: import('vue').DefineComponent<import('vue').Extr
|
|
|
26
26
|
type: FunctionConstructor;
|
|
27
27
|
default: () => {};
|
|
28
28
|
};
|
|
29
|
-
}
|
|
29
|
+
}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
30
30
|
[key: string]: any;
|
|
31
|
-
}>,
|
|
31
|
+
}>, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
32
32
|
asChild: {
|
|
33
33
|
type: BooleanConstructor;
|
|
34
34
|
default: boolean;
|
|
@@ -41,8 +41,8 @@ export declare const Primitive: import('vue').DefineComponent<import('vue').Extr
|
|
|
41
41
|
type: FunctionConstructor;
|
|
42
42
|
default: () => {};
|
|
43
43
|
};
|
|
44
|
-
}
|
|
44
|
+
}>>, {
|
|
45
45
|
as: AsTag;
|
|
46
46
|
asChild: boolean;
|
|
47
47
|
getProps: Function;
|
|
48
|
-
}, {}
|
|
48
|
+
}, {}>;
|
|
@@ -2,4 +2,4 @@ export declare const Slot: import('vue').DefineComponent<{}, () => import('vue')
|
|
|
2
2
|
[key: string]: any;
|
|
3
3
|
}> | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
4
4
|
[key: string]: any;
|
|
5
|
-
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<
|
|
5
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{}>>, {}, {}>;
|
|
@@ -7,15 +7,40 @@ declare function __VLS_template(): {
|
|
|
7
7
|
attrs: Partial<{}>;
|
|
8
8
|
};
|
|
9
9
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
10
|
-
declare const __VLS_component: import('vue').DefineComponent<
|
|
10
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<AnimatePresenceProps>, {
|
|
11
|
+
mode: string;
|
|
12
|
+
initial: boolean;
|
|
13
|
+
multiple: boolean;
|
|
14
|
+
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<AnimatePresenceProps>, {
|
|
15
|
+
mode: string;
|
|
16
|
+
initial: boolean;
|
|
17
|
+
multiple: boolean;
|
|
18
|
+
}>>>, {
|
|
11
19
|
initial: boolean;
|
|
12
20
|
mode: "wait" | "popLayout" | "sync";
|
|
13
21
|
multiple: boolean;
|
|
14
|
-
}, {}
|
|
22
|
+
}, {}>;
|
|
15
23
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
16
24
|
export default _default;
|
|
25
|
+
type __VLS_WithDefaults<P, D> = {
|
|
26
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
27
|
+
default: D[K];
|
|
28
|
+
}> : P[K];
|
|
29
|
+
};
|
|
30
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
31
|
+
type __VLS_TypePropsToOption<T> = {
|
|
32
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
33
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
34
|
+
} : {
|
|
35
|
+
type: import('vue').PropType<T[K]>;
|
|
36
|
+
required: true;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
17
39
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
18
40
|
new (): {
|
|
19
41
|
$slots: S;
|
|
20
42
|
};
|
|
21
43
|
};
|
|
44
|
+
type __VLS_PrettifyLocal<T> = {
|
|
45
|
+
[K in keyof T]: T[K];
|
|
46
|
+
} & {};
|
|
@@ -6,13 +6,34 @@ declare function __VLS_template(): {
|
|
|
6
6
|
attrs: Partial<{}>;
|
|
7
7
|
};
|
|
8
8
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
9
|
-
declare const __VLS_component: import('vue').DefineComponent<
|
|
9
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<import('./types').MotionConfigState>, {
|
|
10
10
|
reduceMotion: "user" | "never" | "always";
|
|
11
|
-
}, {}, {}, {}, string, import('vue').
|
|
11
|
+
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<import('./types').MotionConfigState>, {
|
|
12
|
+
reduceMotion: "user" | "never" | "always";
|
|
13
|
+
}>>>, {
|
|
14
|
+
reduceMotion: "user" | "never" | "always";
|
|
15
|
+
}, {}>;
|
|
12
16
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
13
17
|
export default _default;
|
|
18
|
+
type __VLS_WithDefaults<P, D> = {
|
|
19
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
20
|
+
default: D[K];
|
|
21
|
+
}> : P[K];
|
|
22
|
+
};
|
|
23
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
24
|
+
type __VLS_TypePropsToOption<T> = {
|
|
25
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
26
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
27
|
+
} : {
|
|
28
|
+
type: import('vue').PropType<T[K]>;
|
|
29
|
+
required: true;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
14
32
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
15
33
|
new (): {
|
|
16
34
|
$slots: S;
|
|
17
35
|
};
|
|
18
36
|
};
|
|
37
|
+
type __VLS_PrettifyLocal<T> = {
|
|
38
|
+
[K in keyof T]: T[K];
|
|
39
|
+
} & {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const delay: (ms: number) => Promise<unknown>;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function useDomRef<T extends Element = any>(): Ref<T>;
|
|
1
|
+
export declare function useDomRef<T extends Element = any>(): import('vue').Ref<import('vue').UnwrapRef<T>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { Options } from '../types/state';
|
|
3
|
-
export declare function useInView<T extends Element = any>(domRef: Ref<T>, options?: Options['inViewOptions'] | Ref<Options['inViewOptions']>): Ref<boolean
|
|
3
|
+
export declare function useInView<T extends Element = any>(domRef: Ref<T>, options?: Options['inViewOptions'] | Ref<Options['inViewOptions']>): Ref<boolean>;
|
package/package.json
CHANGED