motion-v 1.7.0 β 1.7.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 +21 -27
- package/dist/es/components/lazy-motion/context.d.ts +1 -1
- package/dist/es/components/motion/props.d.ts +1 -1
- package/dist/es/components/motion/props.mjs +1 -1
- package/dist/es/components/motion/utils.d.ts +2 -2
- package/dist/es/external/.pnpm/motion-dom@12.23.12/external/motion-dom/dist/es/frameloop/microtask.mjs +1 -1
- package/dist/es/features/animation/animation.mjs +1 -1
- package/dist/es/features/dom-animation.d.ts +1 -1
- package/dist/es/features/dom-max.d.ts +1 -1
- package/dist/es/features/feature.d.ts +1 -1
- package/dist/es/state/motion-state.d.ts +1 -1
- package/dist/es/state/motion-state.mjs +20 -26
- package/package.json +1 -1
- package/README.md +0 -106
package/dist/cjs/index.js
CHANGED
|
@@ -7540,7 +7540,7 @@ class AnimationFeature extends Feature {
|
|
|
7540
7540
|
let resolvedVariant = core.isDef(definition) ? resolveVariant(definition, variants, customValue) : void 0;
|
|
7541
7541
|
if (this.state.visualElement.isVariantNode) {
|
|
7542
7542
|
const controlVariant = resolveVariant(this.state.context[name], variants, customValue);
|
|
7543
|
-
resolvedVariant = controlVariant ? Object.assign(controlVariant || {}, resolvedVariant) : variant;
|
|
7543
|
+
resolvedVariant = controlVariant ? Object.assign(controlVariant || {}, resolvedVariant) : Object.assign(variant, resolvedVariant);
|
|
7544
7544
|
}
|
|
7545
7545
|
if (!resolvedVariant)
|
|
7546
7546
|
return;
|
|
@@ -9125,7 +9125,6 @@ function isVariantLabels(value) {
|
|
|
9125
9125
|
}
|
|
9126
9126
|
const mountedStates = /* @__PURE__ */ new WeakMap();
|
|
9127
9127
|
let id = 0;
|
|
9128
|
-
const mountedLayoutIds = /* @__PURE__ */ new Set();
|
|
9129
9128
|
class MotionState {
|
|
9130
9129
|
constructor(options, parent) {
|
|
9131
9130
|
var _a;
|
|
@@ -9192,22 +9191,17 @@ class MotionState {
|
|
|
9192
9191
|
}
|
|
9193
9192
|
// Mount motion state to DOM element, handles parent-child relationships
|
|
9194
9193
|
mount(element, options, notAnimate = false) {
|
|
9195
|
-
var _a;
|
|
9194
|
+
var _a, _b;
|
|
9196
9195
|
heyListen.invariant(
|
|
9197
9196
|
Boolean(element),
|
|
9198
9197
|
"Animation state must be mounted with valid Element"
|
|
9199
9198
|
);
|
|
9200
9199
|
this.element = element;
|
|
9201
9200
|
this.updateOptions(options);
|
|
9201
|
+
this.options.layoutId && ((_a = this.visualElement.projection.getStack()) == null ? void 0 : _a.members.length) > 0;
|
|
9202
9202
|
this.featureManager.mount();
|
|
9203
9203
|
if (!notAnimate && this.options.animate) {
|
|
9204
|
-
(
|
|
9205
|
-
}
|
|
9206
|
-
if (this.options.layoutId) {
|
|
9207
|
-
mountedLayoutIds.add(this.options.layoutId);
|
|
9208
|
-
frame.render(() => {
|
|
9209
|
-
mountedLayoutIds.clear();
|
|
9210
|
-
});
|
|
9204
|
+
(_b = this.startAnimation) == null ? void 0 : _b.call(this);
|
|
9211
9205
|
}
|
|
9212
9206
|
}
|
|
9213
9207
|
clearAnimation() {
|
|
@@ -9231,22 +9225,22 @@ class MotionState {
|
|
|
9231
9225
|
this.featureManager.beforeUnmount();
|
|
9232
9226
|
}
|
|
9233
9227
|
unmount(unMountChildren = false) {
|
|
9234
|
-
|
|
9235
|
-
const
|
|
9236
|
-
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
|
|
9240
|
-
|
|
9241
|
-
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9228
|
+
var _a, _b, _c, _d;
|
|
9229
|
+
const shouldDelay = this.options.layoutId && ((_a = this.visualElement.projection) == null ? void 0 : _a.getStack().lead) === this.visualElement.projection && this.visualElement.projection.isProjecting();
|
|
9230
|
+
if (shouldDelay) {
|
|
9231
|
+
Promise.resolve().then(() => {
|
|
9232
|
+
this.unmount(unMountChildren);
|
|
9233
|
+
});
|
|
9234
|
+
return;
|
|
9235
|
+
}
|
|
9236
|
+
if (unMountChildren) {
|
|
9237
|
+
Array.from(this.children).reverse().forEach(this.unmountChild);
|
|
9238
|
+
}
|
|
9239
|
+
(_c = (_b = this.parent) == null ? void 0 : _b.children) == null ? void 0 : _c.delete(this);
|
|
9240
|
+
mountedStates.delete(this.element);
|
|
9241
|
+
this.featureManager.unmount();
|
|
9242
|
+
(_d = this.visualElement) == null ? void 0 : _d.unmount();
|
|
9243
|
+
this.clearAnimation();
|
|
9250
9244
|
}
|
|
9251
9245
|
unmountChild(child) {
|
|
9252
9246
|
child.unmount(true);
|
|
@@ -9451,7 +9445,7 @@ const MotionComponentProps = {
|
|
|
9451
9445
|
"layoutRoot": { type: Boolean, default: false },
|
|
9452
9446
|
"data-framer-portal-id": { type: String },
|
|
9453
9447
|
"crossfade": { type: Boolean, default: true },
|
|
9454
|
-
"layoutDependency": { type:
|
|
9448
|
+
"layoutDependency": { type: null },
|
|
9455
9449
|
"onBeforeLayoutMeasure": { type: Function },
|
|
9456
9450
|
"onLayoutMeasure": { type: Function },
|
|
9457
9451
|
"onLayoutAnimationStart": { type: Function },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Feature } from '../../features';
|
|
2
2
|
import { Ref } from 'vue';
|
|
3
3
|
export type LazyMotionContext = {
|
|
4
|
-
features: Ref<Feature
|
|
4
|
+
features: Ref<Array<typeof Feature>>;
|
|
5
5
|
strict: boolean;
|
|
6
6
|
};
|
|
7
7
|
export declare const useLazyMotionContext: <T extends LazyMotionContext = LazyMotionContext>(fallback?: T) => T extends null ? LazyMotionContext : LazyMotionContext, lazyMotionContextProvider: (contextValue: LazyMotionContext) => LazyMotionContext;
|
|
@@ -114,7 +114,7 @@ export declare const MotionComponentProps: {
|
|
|
114
114
|
default: boolean;
|
|
115
115
|
};
|
|
116
116
|
layoutDependency: {
|
|
117
|
-
type:
|
|
117
|
+
type: any;
|
|
118
118
|
};
|
|
119
119
|
onBeforeLayoutMeasure: {
|
|
120
120
|
type: FunctionConstructor;
|
|
@@ -51,7 +51,7 @@ const MotionComponentProps = {
|
|
|
51
51
|
"layoutRoot": { type: Boolean, default: false },
|
|
52
52
|
"data-framer-portal-id": { type: String },
|
|
53
53
|
"crossfade": { type: Boolean, default: true },
|
|
54
|
-
"layoutDependency": { type:
|
|
54
|
+
"layoutDependency": { type: null },
|
|
55
55
|
"onBeforeLayoutMeasure": { type: Function },
|
|
56
56
|
"onLayoutMeasure": { type: Function },
|
|
57
57
|
"onLayoutAnimationStart": { type: Function },
|
|
@@ -7,7 +7,7 @@ type MotionCompProps = {
|
|
|
7
7
|
};
|
|
8
8
|
export interface MotionCreateOptions {
|
|
9
9
|
forwardMotionProps?: boolean;
|
|
10
|
-
features?: Feature
|
|
10
|
+
features?: Array<typeof Feature>;
|
|
11
11
|
}
|
|
12
12
|
export declare function checkMotionIsHidden(instance: ComponentPublicInstance): boolean;
|
|
13
13
|
/**
|
|
@@ -18,5 +18,5 @@ export declare function createMotionComponent(component: string | DefineComponen
|
|
|
18
18
|
type MotionNameSpace = {
|
|
19
19
|
[K in keyof IntrinsicElementAttributes]: DefineComponent<Omit<MotionProps<K, unknown>, 'as' | 'asChild' | 'motionConfig' | 'layoutGroup'> & MotionHTMLAttributes<K>, 'create'>;
|
|
20
20
|
} & MotionCompProps;
|
|
21
|
-
export declare function createMotionComponentWithFeatures(features?: Feature
|
|
21
|
+
export declare function createMotionComponentWithFeatures(features?: Array<typeof Feature>): MotionNameSpace;
|
|
22
22
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRenderBatcher } from "./batcher.mjs";
|
|
2
|
-
const { schedule: microtask, cancel: cancelMicrotask } = /* @__PURE__ */ createRenderBatcher(queueMicrotask,
|
|
2
|
+
const { schedule: microtask, cancel: cancelMicrotask } = /* @__PURE__ */ createRenderBatcher(queueMicrotask, true);
|
|
3
3
|
export {
|
|
4
4
|
cancelMicrotask,
|
|
5
5
|
microtask
|
|
@@ -168,7 +168,7 @@ class AnimationFeature extends Feature {
|
|
|
168
168
|
let resolvedVariant = isDef(definition) ? resolveVariant(definition, variants, customValue) : void 0;
|
|
169
169
|
if (this.state.visualElement.isVariantNode) {
|
|
170
170
|
const controlVariant = resolveVariant(this.state.context[name], variants, customValue);
|
|
171
|
-
resolvedVariant = controlVariant ? Object.assign(controlVariant || {}, resolvedVariant) : variant;
|
|
171
|
+
resolvedVariant = controlVariant ? Object.assign(controlVariant || {}, resolvedVariant) : Object.assign(variant, resolvedVariant);
|
|
172
172
|
}
|
|
173
173
|
if (!resolvedVariant)
|
|
174
174
|
return;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Feature } from './feature';
|
|
2
|
-
export declare const domAnimation: Feature
|
|
2
|
+
export declare const domAnimation: Array<typeof Feature>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Feature } from './feature';
|
|
2
|
-
export declare const domMax: Feature
|
|
2
|
+
export declare const domMax: Array<typeof Feature>;
|
|
@@ -17,7 +17,7 @@ export declare class MotionState {
|
|
|
17
17
|
parent?: MotionState;
|
|
18
18
|
options: Options & {
|
|
19
19
|
animatePresenceContext?: PresenceContext;
|
|
20
|
-
features?: Feature
|
|
20
|
+
features?: Array<typeof Feature>;
|
|
21
21
|
lazyMotionContext?: LazyMotionContext;
|
|
22
22
|
};
|
|
23
23
|
isSafeToRemove: boolean;
|
|
@@ -4,10 +4,9 @@ import { FeatureManager } from "../features/feature-manager.mjs";
|
|
|
4
4
|
import { doneCallbacks } from "../components/animate-presence/presence.mjs";
|
|
5
5
|
import { isVariantLabels } from "./utils/is-variant-labels.mjs";
|
|
6
6
|
import { noop } from "../external/.pnpm/motion-utils@12.23.6/external/motion-utils/dist/es/noop.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { cancelFrame, frame } from "../external/.pnpm/motion-dom@12.23.12/external/motion-dom/dist/es/frameloop/frame.mjs";
|
|
8
8
|
const mountedStates = /* @__PURE__ */ new WeakMap();
|
|
9
9
|
let id = 0;
|
|
10
|
-
const mountedLayoutIds = /* @__PURE__ */ new Set();
|
|
11
10
|
class MotionState {
|
|
12
11
|
constructor(options, parent) {
|
|
13
12
|
var _a;
|
|
@@ -74,22 +73,17 @@ class MotionState {
|
|
|
74
73
|
}
|
|
75
74
|
// Mount motion state to DOM element, handles parent-child relationships
|
|
76
75
|
mount(element, options, notAnimate = false) {
|
|
77
|
-
var _a;
|
|
76
|
+
var _a, _b;
|
|
78
77
|
invariant(
|
|
79
78
|
Boolean(element),
|
|
80
79
|
"Animation state must be mounted with valid Element"
|
|
81
80
|
);
|
|
82
81
|
this.element = element;
|
|
83
82
|
this.updateOptions(options);
|
|
83
|
+
this.options.layoutId && ((_a = this.visualElement.projection.getStack()) == null ? void 0 : _a.members.length) > 0;
|
|
84
84
|
this.featureManager.mount();
|
|
85
85
|
if (!notAnimate && this.options.animate) {
|
|
86
|
-
(
|
|
87
|
-
}
|
|
88
|
-
if (this.options.layoutId) {
|
|
89
|
-
mountedLayoutIds.add(this.options.layoutId);
|
|
90
|
-
frame.render(() => {
|
|
91
|
-
mountedLayoutIds.clear();
|
|
92
|
-
});
|
|
86
|
+
(_b = this.startAnimation) == null ? void 0 : _b.call(this);
|
|
93
87
|
}
|
|
94
88
|
}
|
|
95
89
|
clearAnimation() {
|
|
@@ -113,22 +107,22 @@ class MotionState {
|
|
|
113
107
|
this.featureManager.beforeUnmount();
|
|
114
108
|
}
|
|
115
109
|
unmount(unMountChildren = false) {
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
110
|
+
var _a, _b, _c, _d;
|
|
111
|
+
const shouldDelay = this.options.layoutId && ((_a = this.visualElement.projection) == null ? void 0 : _a.getStack().lead) === this.visualElement.projection && this.visualElement.projection.isProjecting();
|
|
112
|
+
if (shouldDelay) {
|
|
113
|
+
Promise.resolve().then(() => {
|
|
114
|
+
this.unmount(unMountChildren);
|
|
115
|
+
});
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (unMountChildren) {
|
|
119
|
+
Array.from(this.children).reverse().forEach(this.unmountChild);
|
|
120
|
+
}
|
|
121
|
+
(_c = (_b = this.parent) == null ? void 0 : _b.children) == null ? void 0 : _c.delete(this);
|
|
122
|
+
mountedStates.delete(this.element);
|
|
123
|
+
this.featureManager.unmount();
|
|
124
|
+
(_d = this.visualElement) == null ? void 0 : _d.unmount();
|
|
125
|
+
this.clearAnimation();
|
|
132
126
|
}
|
|
133
127
|
unmountChild(child) {
|
|
134
128
|
child.unmount(true);
|
package/package.json
CHANGED
package/README.md
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img width="100" height="100" alt="Motion logo" src="https://user-images.githubusercontent.com/7850794/164965523-3eced4c4-6020-467e-acde-f11b7900ad62.png" />
|
|
3
|
-
</p>
|
|
4
|
-
<h1 align="center">Motion for Vue</h1>
|
|
5
|
-
|
|
6
|
-
<br>
|
|
7
|
-
|
|
8
|
-
<p align="center">
|
|
9
|
-
<a href="https://www.npmjs.com/package/motion-v" target="_blank">
|
|
10
|
-
<img src="https://img.shields.io/npm/v/motion-v.svg?style=flat-square" />
|
|
11
|
-
</a>
|
|
12
|
-
<a href="https://www.npmjs.com/package/motion-v" target="_blank">
|
|
13
|
-
<img src="https://img.shields.io/npm/dm/motion-v.svg?style=flat-square" />
|
|
14
|
-
</a>
|
|
15
|
-
<a href="https://twitter.com/motiondotdev" target="_blank">
|
|
16
|
-
<img src="https://img.shields.io/twitter/follow/framer.svg?style=social&label=Follow" />
|
|
17
|
-
</a>
|
|
18
|
-
</p>
|
|
19
|
-
|
|
20
|
-
<br>
|
|
21
|
-
<hr>
|
|
22
|
-
<br>
|
|
23
|
-
|
|
24
|
-
Motion for Vue is an open source, production-ready library thatβs designed for all creative developers.
|
|
25
|
-
|
|
26
|
-
It's the only animation library with a hybrid engine, combining the power of JavaScript animations with the performance of native browser APIs.
|
|
27
|
-
|
|
28
|
-
It looks like this:
|
|
29
|
-
|
|
30
|
-
```jsx
|
|
31
|
-
<motion.div :animate="{ x: 100 }" />
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
It does all this:
|
|
35
|
-
|
|
36
|
-
- Springs
|
|
37
|
-
- Keyframes
|
|
38
|
-
- Layout animations
|
|
39
|
-
- Shared layout animations
|
|
40
|
-
- Gestures (drag/tap/hover)
|
|
41
|
-
- Scroll animations
|
|
42
|
-
- SVG paths
|
|
43
|
-
- Exit animations
|
|
44
|
-
- Server-side rendering
|
|
45
|
-
- Independent transforms
|
|
46
|
-
- Orchestrate animations across components
|
|
47
|
-
- CSS variables
|
|
48
|
-
|
|
49
|
-
...and a whole lot more.
|
|
50
|
-
|
|
51
|
-
## Get started
|
|
52
|
-
|
|
53
|
-
### π Quick start
|
|
54
|
-
|
|
55
|
-
Install `motion-v` via your package manager:
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
npm install motion-v
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Then import the `motion` component:
|
|
62
|
-
|
|
63
|
-
```vue
|
|
64
|
-
<script setup>
|
|
65
|
-
import { motion } from 'motion-v'
|
|
66
|
-
</script>
|
|
67
|
-
|
|
68
|
-
<template>
|
|
69
|
-
<motion.div :animate="{ x: 100 }" />
|
|
70
|
-
</template>
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### π Contribute
|
|
74
|
-
|
|
75
|
-
- Want to contribute to Motion? Our [contributing guide](https://github.com/motiondivision/motion-vue/blob/master/CONTRIBUTING.md) has you covered.
|
|
76
|
-
- [Join our discord ](https://discord.com/invite/dCBuRgdNDG)
|
|
77
|
-
|
|
78
|
-
### π©π»ββοΈ License
|
|
79
|
-
|
|
80
|
-
- Motion for Vue is MIT licensed.
|
|
81
|
-
|
|
82
|
-
## β¨ Sponsors
|
|
83
|
-
|
|
84
|
-
Motion is sustainable thanks to the kind support of its sponsors.
|
|
85
|
-
|
|
86
|
-
### Partners
|
|
87
|
-
|
|
88
|
-
#### Framer
|
|
89
|
-
|
|
90
|
-
Motion powers Framer animations, the web builder for creative pros. Design and ship your dream site. Zero code, maximum speed.
|
|
91
|
-
|
|
92
|
-
<a href="https://www.framer.com?utm_source=motion-readme">
|
|
93
|
-
<img alt="Framer" src="https://github.com/user-attachments/assets/0404c7a1-c29d-4785-89ae-aae315f3c759" width="300px" height="200px">
|
|
94
|
-
</a>
|
|
95
|
-
|
|
96
|
-
### Platinum
|
|
97
|
-
|
|
98
|
-
<a href="https://syntax.fm"><img alt="Syntax.fm" src="https://github.com/user-attachments/assets/ab852bfe-b36c-490b-b98d-4061158c4863" width="300px" height="200px"></a> <a href="https://tailwindcss.com"><img alt="Tailwind" src="https://github.com/user-attachments/assets/c0496f09-b8ee-4bc4-85ab-83a071bbbdec" width="300px" height="200px"></a> <a href="https://emilkowal.ski"><img alt="Emil Kowalski" src="https://github.com/user-attachments/assets/29f56b1a-37fb-4695-a6a6-151f6c24864f" width="300px" height="200px"></a> <a href="https://linear.app"><img alt="Linear" src="https://github.com/user-attachments/assets/a93710bb-d8ed-40e3-b0fb-1c5b3e2b16bb" width="300px" height="200px"></a>
|
|
99
|
-
|
|
100
|
-
### Gold
|
|
101
|
-
|
|
102
|
-
<a href="https://vercel.com"><img alt="Vercel" src="https://github.com/user-attachments/assets/23cb1e37-fa67-49ad-8f77-7f4b8eaba325" width="225px" height="150px"></a> <a href="https://liveblocks.io"><img alt="Liveblocks" src="https://github.com/user-attachments/assets/31436a47-951e-4eab-9a68-bdd54ccf9444" width="225px" height="150px"></a> <a href="https://lu.ma"><img alt="Luma" src="https://github.com/user-attachments/assets/4fae0c9d-de0f-4042-9cd6-e07885d028a9" width="225px" height="150px"></a>
|
|
103
|
-
|
|
104
|
-
### Silver
|
|
105
|
-
|
|
106
|
-
<a href="https://www.frontend.fyi/?utm_source=motion"><img alt="Frontend.fyi" src="https://github.com/user-attachments/assets/07d23aa5-69db-44a0-849d-90177e6fc817" width="150px" height="100px"></a> <a href="https://statamic.com"><img alt="Statamic" src="https://github.com/user-attachments/assets/5d28f090-bdd9-4b31-b134-fb2b94ca636f" width="150px" height="100px"></a> <a href="https://firecrawl.dev"><img alt="Firecrawl" src="https://github.com/user-attachments/assets/cba90e54-1329-4353-8fba-85beef4d2ee9" width="150px" height="100px"></a> <a href="https://puzzmo.com"><img alt="Puzzmo" src="https://github.com/user-attachments/assets/aa2d5586-e5e2-43b9-8446-db456e4b0758" width="150px" height="100px"></a> <a href="https://buildui.com"><img alt="Build UI" src="https://github.com/user-attachments/assets/024bfcd5-50e8-4b3d-a115-d5c6d6030d1c" width="150px" height="100px"></a> <a href="https://hover.dev"><img alt="Hover" src="https://github.com/user-attachments/assets/4715b555-d2ac-4cb7-9f35-d36d708827b3" width="150px" height="100px"></a>
|