motion-v 0.4.1 → 0.5.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 +287 -96
- package/dist/es/components/AnimatePresence.vue.mjs +13 -2
- package/dist/es/components/LayoutGroup.vue.mjs +3 -23
- package/dist/es/components/Motion.vue.mjs +16 -15
- package/dist/es/components/presence.mjs +5 -2
- package/dist/es/components/use-layout-group.mjs +34 -0
- package/dist/es/components/use-pop-layout.mjs +47 -0
- package/dist/es/components/utils.mjs +8 -0
- package/dist/es/constants/index.mjs +1 -1
- package/dist/es/features/gestures/hover.mjs +4 -0
- package/dist/es/features/gestures/in-view.mjs +4 -0
- package/dist/es/features/layout/layout.mjs +7 -4
- package/dist/es/state/animate-variants-children.mjs +72 -0
- package/dist/es/state/motion-state.mjs +67 -20
- package/dist/es/state/schedule.mjs +1 -1
- package/dist/src/components/AnimatePresence.d.ts +2 -7
- package/dist/src/components/LayoutGroup.d.ts +1 -5
- package/dist/src/components/Motion.d.ts +1 -3
- package/dist/src/components/presence.d.ts +2 -1
- package/dist/src/components/type.d.ts +5 -24
- package/dist/src/components/use-layout-group.d.ts +20 -0
- package/dist/src/components/use-pop-layout.d.ts +6 -0
- package/dist/src/components/utils.d.ts +1 -0
- package/dist/src/features/layout/types.d.ts +1 -1
- package/dist/src/index.d.ts +5 -3
- package/dist/src/state/animate-variants-children.d.ts +15 -0
- package/dist/src/state/motion-state.d.ts +7 -7
- package/dist/src/types/state.d.ts +11 -2
- package/package.json +1 -1
- /package/dist/es/external/.pnpm/{@vueuse_shared@12.0.0_typescript@5.5.4 → @vueuse_shared@12.0.0_typescript@5.7.2}/external/@vueuse/shared/index.mjs +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MotionState } from './motion-state';
|
|
2
|
+
import { AnimateOptions, AnimationFactory } from '../types';
|
|
3
|
+
export type ActiveVariant = {
|
|
4
|
+
[key: string]: {
|
|
5
|
+
definition: string;
|
|
6
|
+
transition: AnimateOptions;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare function animateVariantsChildren(state: MotionState, activeState: ActiveVariant): {
|
|
10
|
+
animations: any[];
|
|
11
|
+
getAnimations: () => Promise<void>;
|
|
12
|
+
} | {
|
|
13
|
+
animations: AnimationFactory[];
|
|
14
|
+
getAnimations: () => Promise<unknown[]>;
|
|
15
|
+
};
|
|
@@ -4,13 +4,14 @@ declare const STATE_TYPES: readonly ["initial", "animate", "inView", "hover", "p
|
|
|
4
4
|
type StateType = typeof STATE_TYPES[number];
|
|
5
5
|
export declare const mountedStates: WeakMap<Element, MotionState>;
|
|
6
6
|
export declare class MotionState {
|
|
7
|
+
readonly id: string;
|
|
7
8
|
element: HTMLElement | null;
|
|
8
9
|
private parent?;
|
|
9
10
|
private options;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
activeStates: Partial<Record<StateType, boolean>>;
|
|
12
|
+
depth: number;
|
|
13
|
+
baseTarget: DOMKeyframesDefinition;
|
|
14
|
+
target: DOMKeyframesDefinition;
|
|
14
15
|
private featureManager;
|
|
15
16
|
visualElement: VisualElement;
|
|
16
17
|
constructor(options: Options, parent?: MotionState);
|
|
@@ -18,14 +19,13 @@ export declare class MotionState {
|
|
|
18
19
|
get context(): MotionStateContext;
|
|
19
20
|
private initTarget;
|
|
20
21
|
get initial(): string | boolean | import('../types').Variant;
|
|
21
|
-
|
|
22
|
+
updateOptions(): void;
|
|
23
|
+
mount(element: HTMLElement, options: Options): void;
|
|
22
24
|
unmount(): void;
|
|
23
25
|
update(options: Options): void;
|
|
24
26
|
setActive(name: StateType, isActive: boolean): void;
|
|
25
27
|
animateUpdates(): Generator<any, void, unknown>;
|
|
26
28
|
isMounted(): boolean;
|
|
27
|
-
getDepth(): number;
|
|
28
29
|
getOptions(): Options<any>;
|
|
29
|
-
getTarget(): DOMKeyframesDefinition;
|
|
30
30
|
}
|
|
31
31
|
export {};
|
|
@@ -4,8 +4,17 @@ import { IntrinsicElementAttributes } from 'vue';
|
|
|
4
4
|
import { TransformProperties } from './transform';
|
|
5
5
|
import { LayoutOptions } from '../features/layout/types';
|
|
6
6
|
type AnimationPlaybackControls = ReturnType<typeof animate>;
|
|
7
|
+
export interface Orchestration {
|
|
8
|
+
delay?: number;
|
|
9
|
+
when?: false | 'beforeChildren' | 'afterChildren' | string;
|
|
10
|
+
delayChildren?: number;
|
|
11
|
+
staggerChildren?: number;
|
|
12
|
+
staggerDirection?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface AnimateOptions extends Omit<Orchestration, 'delay'>, DynamicAnimationOptions {
|
|
15
|
+
}
|
|
7
16
|
export interface Variant extends DOMKeyframesDefinition {
|
|
8
|
-
transition?:
|
|
17
|
+
transition?: AnimateOptions;
|
|
9
18
|
}
|
|
10
19
|
export type VariantLabels = string | Variant;
|
|
11
20
|
type MarginValue = `${number}${'px' | '%'}`;
|
|
@@ -46,7 +55,7 @@ export interface Options<T = any> extends LayoutOptions {
|
|
|
46
55
|
};
|
|
47
56
|
style?: MotionStyle;
|
|
48
57
|
transformTemplate?: (transform: TransformProperties, generatedTransform: string) => string;
|
|
49
|
-
transition?:
|
|
58
|
+
transition?: AnimateOptions;
|
|
50
59
|
onMotionStart?: (target: DOMKeyframesDefinition) => void;
|
|
51
60
|
onMotionComplete?: (target: DOMKeyframesDefinition) => void;
|
|
52
61
|
onHoverStart?: (e: PointerEvent) => void;
|
package/package.json
CHANGED