motion-v 0.2.2 → 0.2.4
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/index.js +1077 -979
- package/dist/index.umd.cjs +1 -1
- package/dist/nuxt/index.cjs +51 -0
- package/dist/nuxt/index.d.cts +10 -0
- package/dist/nuxt/index.d.mts +10 -0
- package/dist/nuxt/index.mjs +49 -0
- package/dist/src/components/AnimatePresence.d.ts +2 -2
- package/dist/src/components/Motion.d.ts +2 -3
- package/dist/src/components/Primitive.d.ts +1 -1
- package/dist/src/components/context.d.ts +0 -5
- package/dist/src/components/presence.d.ts +1 -0
- package/dist/src/constants/index.d.ts +9 -0
- package/dist/src/features/gestures/drag/types.d.ts +1 -1
- package/dist/src/features/gestures/types.d.ts +1 -1
- package/dist/src/features/index.d.ts +1 -0
- package/dist/src/features/svg.d.ts +5 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/state/event.d.ts +1 -1
- package/dist/src/state/motion-state.d.ts +4 -4
- package/dist/src/state/style.d.ts +5 -1
- package/dist/src/state/transform.d.ts +1 -1
- package/dist/src/state/utils.d.ts +1 -1
- package/dist/src/types/index.d.ts +2 -0
- package/dist/src/types/motion-values.d.ts +91 -0
- package/dist/src/{state/types.d.ts → types/state.d.ts} +2 -3
- package/package.json +28 -2
|
@@ -3,5 +3,6 @@ export declare const doneCallbacks: WeakMap<Element, VoidFunction>;
|
|
|
3
3
|
export declare function removeDoneCallback(element: Element): void;
|
|
4
4
|
export interface PresenceContext {
|
|
5
5
|
initial: Ref<boolean>;
|
|
6
|
+
safeUnmount: (el: Element) => boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare const injectAnimatePresence: <T extends PresenceContext = PresenceContext>(fallback?: T) => T extends null ? PresenceContext : PresenceContext, provideAnimatePresence: (contextValue: PresenceContext) => PresenceContext;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export { motionValue as useMotionValue } from 'framer-motion/dom';
|
|
|
3
3
|
export { default as Motion, type MotionProps } from './components/Motion';
|
|
4
4
|
export { default as AnimatePresence, type AnimatePresenceProps } from './components/AnimatePresence';
|
|
5
5
|
export * from './value';
|
|
6
|
+
export * from './constants';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Variant } from '
|
|
1
|
+
import { Variant } from '../types';
|
|
2
2
|
export type MotionEventNames = 'motionstart' | 'motioncomplete' | 'hoverstart' | 'hoverend' | 'pressstart' | 'pressend' | 'viewenter' | 'viewleave';
|
|
3
3
|
export declare function motionEvent(name: MotionEventNames, target: Variant, isExit?: boolean): CustomEvent<{
|
|
4
4
|
target: Variant;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Options } from '
|
|
2
|
-
import { DOMKeyframesDefinition } from 'framer-motion';
|
|
1
|
+
import { Options } from '../types';
|
|
2
|
+
import { DOMKeyframesDefinition, VisualElement } from 'framer-motion';
|
|
3
3
|
declare const STATE_TYPES: readonly ["initial", "animate", "inView", "hover", "press", "exit", "drag"];
|
|
4
4
|
type StateType = typeof STATE_TYPES[number];
|
|
5
5
|
export declare const mountedStates: WeakMap<Element, MotionState>;
|
|
@@ -13,11 +13,11 @@ export declare class MotionState {
|
|
|
13
13
|
private baseTarget;
|
|
14
14
|
private target;
|
|
15
15
|
private featureManager;
|
|
16
|
-
|
|
16
|
+
visualElement: VisualElement;
|
|
17
17
|
constructor(options: Options, parent?: MotionState);
|
|
18
18
|
private initContext;
|
|
19
19
|
private initTarget;
|
|
20
|
-
get initial(): string | boolean | import('
|
|
20
|
+
get initial(): string | boolean | import('../types').Variant;
|
|
21
21
|
mount(element: HTMLElement): void;
|
|
22
22
|
unmount(): void;
|
|
23
23
|
update(options: Options): void;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { DOMKeyframesDefinition } from 'framer-motion';
|
|
2
|
-
import { MotionStyle } from '
|
|
2
|
+
import { MotionStyle } from '../types';
|
|
3
3
|
export declare const style: {
|
|
4
4
|
get: (element: Element, name: string) => string | undefined;
|
|
5
5
|
set: (element: Element, name: string, value: string | number) => void;
|
|
6
6
|
};
|
|
7
7
|
export declare function createStyles(keyframes?: MotionStyle | DOMKeyframesDefinition): any;
|
|
8
|
+
export declare function convertSvgStyleToAttributes(keyframes?: MotionStyle | DOMKeyframesDefinition): {
|
|
9
|
+
attributes: Record<string, any>;
|
|
10
|
+
style: Record<string, any>;
|
|
11
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Options } from '
|
|
1
|
+
import { Options } from '../types';
|
|
2
2
|
import { DynamicAnimationOptions, Variant } from 'framer-motion';
|
|
3
3
|
import { IntrinsicElementAttributes } from 'vue';
|
|
4
4
|
export declare function resolveVariant(definition?: Options['initial'], variants?: Options['variants']): Variant | undefined;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export * from './transform';
|
|
2
2
|
export * from './framer-motion';
|
|
3
|
+
export * from './motion-values';
|
|
4
|
+
export * from './state';
|
|
3
5
|
export type MotionEventNames = 'motionstart' | 'motioncomplete' | 'hoverstart' | 'hoverend' | 'pressstart' | 'pressend' | 'viewenter' | 'viewleave' | 'dragstart' | 'dragend' | 'dragcancel' | 'dragmove' | 'drag';
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { MotionValue } from 'framer-motion/dom';
|
|
2
|
+
import { Options } from './state';
|
|
3
|
+
import { AriaAttributes, Events, SVGAttributes } from 'vue';
|
|
4
|
+
type EventHandlers<E> = {
|
|
5
|
+
[K in keyof E]?: E[K] extends (...args: any) => any ? E[K] : (payload: E[K]) => void;
|
|
6
|
+
};
|
|
7
|
+
type EventKeys = keyof EventHandlers<Events>;
|
|
8
|
+
interface SVGAttributesWithoutMotionProps extends Pick<SVGAttributes, Exclude<keyof SVGAttributes, keyof Options | keyof AriaAttributes | EventKeys>> {
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export interface CustomValueType {
|
|
14
|
+
mix: (from: any, to: any) => (p: number) => number | string;
|
|
15
|
+
toValue: () => number | string;
|
|
16
|
+
}
|
|
17
|
+
export type MakeCustomValueType<T> = {
|
|
18
|
+
[K in keyof T]: T[K] | CustomValueType;
|
|
19
|
+
};
|
|
20
|
+
export type MakeMotion<T> = MakeCustomValueType<{
|
|
21
|
+
[K in keyof T]: T[K] | MotionValue<number> | MotionValue<string> | MotionValue<any>;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Blanket-accept any SVG attribute as a `MotionValue`
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export type SVGAttributesAsMotionValues = MakeMotion<SVGAttributesWithoutMotionProps>;
|
|
28
|
+
export interface SVGAttributesWithMotionValues {
|
|
29
|
+
svg: SVGAttributesAsMotionValues;
|
|
30
|
+
animate: SVGAttributesAsMotionValues;
|
|
31
|
+
animateMotion: SVGAttributesAsMotionValues;
|
|
32
|
+
animateTransform: SVGAttributesAsMotionValues;
|
|
33
|
+
circle: SVGAttributesAsMotionValues;
|
|
34
|
+
clipPath: SVGAttributesAsMotionValues;
|
|
35
|
+
defs: SVGAttributesAsMotionValues;
|
|
36
|
+
desc: SVGAttributesAsMotionValues;
|
|
37
|
+
ellipse: SVGAttributesAsMotionValues;
|
|
38
|
+
feBlend: SVGAttributesAsMotionValues;
|
|
39
|
+
feColorMatrix: SVGAttributesAsMotionValues;
|
|
40
|
+
feComponentTransfer: SVGAttributesAsMotionValues;
|
|
41
|
+
feComposite: SVGAttributesAsMotionValues;
|
|
42
|
+
feConvolveMatrix: SVGAttributesAsMotionValues;
|
|
43
|
+
feDiffuseLighting: SVGAttributesAsMotionValues;
|
|
44
|
+
feDisplacementMap: SVGAttributesAsMotionValues;
|
|
45
|
+
feDistantLight: SVGAttributesAsMotionValues;
|
|
46
|
+
feDropShadow: SVGAttributesAsMotionValues;
|
|
47
|
+
feFlood: SVGAttributesAsMotionValues;
|
|
48
|
+
feFuncA: SVGAttributesAsMotionValues;
|
|
49
|
+
feFuncB: SVGAttributesAsMotionValues;
|
|
50
|
+
feFuncG: SVGAttributesAsMotionValues;
|
|
51
|
+
feFuncR: SVGAttributesAsMotionValues;
|
|
52
|
+
feGaussianBlur: SVGAttributesAsMotionValues;
|
|
53
|
+
feImage: SVGAttributesAsMotionValues;
|
|
54
|
+
feMerge: SVGAttributesAsMotionValues;
|
|
55
|
+
feMergeNode: SVGAttributesAsMotionValues;
|
|
56
|
+
feMorphology: SVGAttributesAsMotionValues;
|
|
57
|
+
feOffset: SVGAttributesAsMotionValues;
|
|
58
|
+
fePointLight: SVGAttributesAsMotionValues;
|
|
59
|
+
feSpecularLighting: SVGAttributesAsMotionValues;
|
|
60
|
+
feSpotLight: SVGAttributesAsMotionValues;
|
|
61
|
+
feTile: SVGAttributesAsMotionValues;
|
|
62
|
+
feTurbulence: SVGAttributesAsMotionValues;
|
|
63
|
+
filter: SVGAttributesAsMotionValues;
|
|
64
|
+
foreignObject: SVGAttributesAsMotionValues;
|
|
65
|
+
g: SVGAttributesAsMotionValues;
|
|
66
|
+
image: SVGAttributesAsMotionValues;
|
|
67
|
+
line: SVGAttributesAsMotionValues;
|
|
68
|
+
linearGradient: SVGAttributesAsMotionValues;
|
|
69
|
+
marker: SVGAttributesAsMotionValues;
|
|
70
|
+
mask: SVGAttributesAsMotionValues;
|
|
71
|
+
metadata: SVGAttributesAsMotionValues;
|
|
72
|
+
mpath: SVGAttributesAsMotionValues;
|
|
73
|
+
path: SVGAttributesAsMotionValues;
|
|
74
|
+
pattern: SVGAttributesAsMotionValues;
|
|
75
|
+
polygon: SVGAttributesAsMotionValues;
|
|
76
|
+
polyline: SVGAttributesAsMotionValues;
|
|
77
|
+
radialGradient: SVGAttributesAsMotionValues;
|
|
78
|
+
rect: SVGAttributesAsMotionValues;
|
|
79
|
+
stop: SVGAttributesAsMotionValues;
|
|
80
|
+
switch: SVGAttributesAsMotionValues;
|
|
81
|
+
symbol: SVGAttributesAsMotionValues;
|
|
82
|
+
text: SVGAttributesAsMotionValues;
|
|
83
|
+
textPath: SVGAttributesAsMotionValues;
|
|
84
|
+
tspan: SVGAttributesAsMotionValues;
|
|
85
|
+
use: SVGAttributesAsMotionValues;
|
|
86
|
+
view: SVGAttributesAsMotionValues;
|
|
87
|
+
}
|
|
88
|
+
export type SetMotionValueType<T, Keys extends keyof T> = {
|
|
89
|
+
[K in keyof T]: K extends Keys ? SVGAttributesAsMotionValues : T[K];
|
|
90
|
+
};
|
|
91
|
+
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { TransformProperties } from '../types';
|
|
2
1
|
import { DOMKeyframesDefinition, DynamicAnimationOptions } from 'framer-motion';
|
|
3
|
-
import { MotionValue } from 'framer-motion/dom';
|
|
4
|
-
import { animate } from '../../node_modules/framer-motion/dist/es/animation/animate/index.mjs';
|
|
2
|
+
import { MotionValue, animate } from 'framer-motion/dom';
|
|
5
3
|
import { IntrinsicElementAttributes } from 'vue';
|
|
4
|
+
import { TransformProperties } from './transform';
|
|
6
5
|
type AnimationPlaybackControls = ReturnType<typeof animate>;
|
|
7
6
|
export interface Variant extends DOMKeyframesDefinition {
|
|
8
7
|
transition?: DynamicAnimationOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motion-v",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,18 +9,44 @@
|
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/rick-hup/motion-vue.git"
|
|
11
11
|
},
|
|
12
|
-
"keywords": [
|
|
12
|
+
"keywords": [
|
|
13
|
+
"vue",
|
|
14
|
+
"motion",
|
|
15
|
+
"motionone"
|
|
16
|
+
],
|
|
13
17
|
"sideEffects": false,
|
|
14
18
|
"exports": {
|
|
15
19
|
".": {
|
|
16
20
|
"types": "./dist/src/index.d.ts",
|
|
17
21
|
"import": "./dist/index.js",
|
|
18
22
|
"require": "./dist/index.umd.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./nuxt": {
|
|
25
|
+
"import": {
|
|
26
|
+
"types": "./dist/nuxt/index.d.mts",
|
|
27
|
+
"default": "./dist/nuxt/index.mjs"
|
|
28
|
+
},
|
|
29
|
+
"require": {
|
|
30
|
+
"types": "./dist/nuxt/index.d.cts",
|
|
31
|
+
"default": "./dist/nuxt/index.cjs"
|
|
32
|
+
}
|
|
19
33
|
}
|
|
20
34
|
},
|
|
21
35
|
"main": "./dist/index.umd.cjs",
|
|
22
36
|
"module": "./dist/index.js",
|
|
23
37
|
"types": "./dist/src/index.d.ts",
|
|
38
|
+
"typesVersions": {
|
|
39
|
+
"*": {
|
|
40
|
+
"*": [
|
|
41
|
+
"./dist/*/index.d.ts",
|
|
42
|
+
"./dist/index.d.ts"
|
|
43
|
+
],
|
|
44
|
+
"nuxt": [
|
|
45
|
+
"./dist/nuxt/index.d.mts",
|
|
46
|
+
"./dist/nuxt/index.d.ts"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
24
50
|
"files": [
|
|
25
51
|
"./LICENSE",
|
|
26
52
|
"./dist"
|