motion-v 0.11.0-beta.6 β 0.11.0
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/README.md +90 -16
- package/dist/cjs/index.js +83 -40
- package/dist/es/components/animate-presence/AnimatePresence.d.ts +1 -1
- package/dist/es/components/motion/Motion.d.ts +9 -1
- package/dist/es/components/motion/Motion.vue.mjs +36 -7
- package/dist/es/components/motion-config/MotionConfig.d.ts +2 -2
- package/dist/es/components/motion-config/MotionConfig.vue.mjs +4 -2
- package/dist/es/components/motion-config/types.d.ts +2 -0
- package/dist/es/components/reorder/Group.vue.mjs +8 -4
- package/dist/es/components/reorder/Item.d.ts +6 -6
- package/dist/es/components/reorder/Item.vue.mjs +8 -4
- package/dist/es/features/gestures/focus/index.mjs +2 -2
- package/dist/es/features/gestures/focus/types.d.ts +7 -0
- package/dist/es/features/gestures/hover/index.mjs +2 -2
- package/dist/es/features/gestures/hover/types.d.ts +7 -0
- package/dist/es/features/gestures/in-view/index.mjs +2 -2
- package/dist/es/features/gestures/in-view/types.d.ts +7 -0
- package/dist/es/features/gestures/press/index.mjs +2 -2
- package/dist/es/features/gestures/press/types.d.ts +7 -0
- package/dist/es/state/animate-updates.d.ts +1 -1
- package/dist/es/state/animate-updates.mjs +15 -11
- package/dist/es/state/motion-state.mjs +4 -4
- package/dist/es/state/utils/is-variant-labels.mjs +1 -1
- package/dist/es/types/state.d.ts +1 -1
- package/dist/resolver/index.cjs +25 -0
- package/dist/resolver/index.d.cts +5 -0
- package/dist/resolver/index.d.mts +5 -0
- package/dist/resolver/index.mjs +23 -0
- package/package.json +13 -3
package/README.md
CHANGED
|
@@ -1,31 +1,105 @@
|
|
|
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>
|
|
1
4
|
<h1 align="center">Motion for Vue</h1>
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
<br>
|
|
4
7
|
|
|
5
|
-
|
|
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>
|
|
6
19
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- β‘οΈ High Performance Animation
|
|
11
|
-
- π Variants Animation System
|
|
12
|
-
- π Viewport Animation Trigger
|
|
13
|
-
- πͺ Enter/Exit Animation Support
|
|
20
|
+
<br>
|
|
21
|
+
<hr>
|
|
22
|
+
<br>
|
|
14
23
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
+
```
|
|
18
58
|
npm install motion-v
|
|
19
59
|
```
|
|
20
|
-
|
|
60
|
+
|
|
61
|
+
Then import the `motion` component:
|
|
62
|
+
|
|
21
63
|
```vue
|
|
22
64
|
<script setup>
|
|
23
|
-
import {
|
|
65
|
+
import { motion } from 'motion-v'
|
|
24
66
|
</script>
|
|
25
67
|
|
|
26
68
|
<template>
|
|
27
|
-
<
|
|
69
|
+
<motion.div :animate="{ x: 100 }" />
|
|
28
70
|
</template>
|
|
29
71
|
```
|
|
30
72
|
|
|
31
|
-
|
|
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
|
+
|
|
77
|
+
### π©π»ββοΈ License
|
|
78
|
+
|
|
79
|
+
- Motion for Vue is MIT licensed.
|
|
80
|
+
|
|
81
|
+
## β¨ Sponsors
|
|
82
|
+
|
|
83
|
+
Motion is sustainable thanks to the kind support of its sponsors.
|
|
84
|
+
|
|
85
|
+
### Partners
|
|
86
|
+
|
|
87
|
+
#### Framer
|
|
88
|
+
|
|
89
|
+
Motion powers Framer animations, the web builder for creative pros. Design and ship your dream site. Zero code, maximum speed.
|
|
90
|
+
|
|
91
|
+
<a href="https://www.framer.com?utm_source=motion-readme">
|
|
92
|
+
<img alt="Framer" src="https://github.com/user-attachments/assets/0404c7a1-c29d-4785-89ae-aae315f3c759" width="300px" height="200px">
|
|
93
|
+
</a>
|
|
94
|
+
|
|
95
|
+
### Platinum
|
|
96
|
+
|
|
97
|
+
<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>
|
|
98
|
+
|
|
99
|
+
### Gold
|
|
100
|
+
|
|
101
|
+
<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>
|
|
102
|
+
|
|
103
|
+
### Silver
|
|
104
|
+
|
|
105
|
+
<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>
|
package/dist/cjs/index.js
CHANGED
|
@@ -5386,8 +5386,8 @@ class Feature {
|
|
|
5386
5386
|
}
|
|
5387
5387
|
function handleHoverEvent$1(state2, event, lifecycle) {
|
|
5388
5388
|
const props = state2.options;
|
|
5389
|
-
if (props.
|
|
5390
|
-
state2.setActive("
|
|
5389
|
+
if (props.whileHover) {
|
|
5390
|
+
state2.setActive("whileHover", lifecycle === "Start");
|
|
5391
5391
|
}
|
|
5392
5392
|
const eventName = `onHover${lifecycle}`;
|
|
5393
5393
|
const callback = props[eventName];
|
|
@@ -5427,8 +5427,8 @@ function extractEventInfo$1(event) {
|
|
|
5427
5427
|
}
|
|
5428
5428
|
function handlePressEvent(state2, event, lifecycle) {
|
|
5429
5429
|
const props = state2.options;
|
|
5430
|
-
if (props.
|
|
5431
|
-
state2.setActive("
|
|
5430
|
+
if (props.whilePress) {
|
|
5431
|
+
state2.setActive("whilePress", lifecycle === "Start");
|
|
5432
5432
|
}
|
|
5433
5433
|
const eventName = `onPress${lifecycle === "End" ? "" : lifecycle}`;
|
|
5434
5434
|
const callback = props[eventName];
|
|
@@ -5463,8 +5463,8 @@ class PressGesture extends Feature {
|
|
|
5463
5463
|
}
|
|
5464
5464
|
function handleHoverEvent(state2, entry, lifecycle) {
|
|
5465
5465
|
const props = state2.options;
|
|
5466
|
-
if (props.
|
|
5467
|
-
state2.setActive("
|
|
5466
|
+
if (props.whileInView) {
|
|
5467
|
+
state2.setActive("whileInView", lifecycle === "Enter");
|
|
5468
5468
|
}
|
|
5469
5469
|
const eventName = `onViewport${lifecycle}`;
|
|
5470
5470
|
const callback = props[eventName];
|
|
@@ -8025,13 +8025,13 @@ class FocusGesture extends Feature {
|
|
|
8025
8025
|
}
|
|
8026
8026
|
if (!isFocusVisible)
|
|
8027
8027
|
return;
|
|
8028
|
-
this.state.setActive("
|
|
8028
|
+
this.state.setActive("whileFocus", true);
|
|
8029
8029
|
this.isActive = true;
|
|
8030
8030
|
}
|
|
8031
8031
|
onBlur() {
|
|
8032
8032
|
if (!this.isActive)
|
|
8033
8033
|
return;
|
|
8034
|
-
this.state.setActive("
|
|
8034
|
+
this.state.setActive("whileFocus", false);
|
|
8035
8035
|
this.isActive = false;
|
|
8036
8036
|
}
|
|
8037
8037
|
mount() {
|
|
@@ -8119,7 +8119,7 @@ function createVisualElement(Component, options) {
|
|
|
8119
8119
|
function motionEvent(name, target, isExit) {
|
|
8120
8120
|
return new CustomEvent(name, { detail: { target, isExit } });
|
|
8121
8121
|
}
|
|
8122
|
-
const STATE_TYPES = ["initial", "animate", "
|
|
8122
|
+
const STATE_TYPES = ["initial", "animate", "whileInView", "whileHover", "whilePress", "whileDrag", "whileFocus", "exit"];
|
|
8123
8123
|
function animateUpdates({
|
|
8124
8124
|
controlActiveState = void 0,
|
|
8125
8125
|
controlDelay = 0,
|
|
@@ -8129,31 +8129,34 @@ function animateUpdates({
|
|
|
8129
8129
|
} = {}) {
|
|
8130
8130
|
const prevTarget = this.target;
|
|
8131
8131
|
this.target = { ...this.baseTarget };
|
|
8132
|
-
|
|
8132
|
+
let animationOptions = {};
|
|
8133
8133
|
const transition = { ...this.options.transition };
|
|
8134
8134
|
if (directAnimate)
|
|
8135
|
-
resolveDirectAnimation.call(this, directAnimate, directTransition, animationOptions);
|
|
8135
|
+
animationOptions = resolveDirectAnimation.call(this, directAnimate, directTransition, animationOptions);
|
|
8136
8136
|
else
|
|
8137
|
-
resolveStateAnimation.call(this, controlActiveState,
|
|
8137
|
+
animationOptions = resolveStateAnimation.call(this, controlActiveState, transition);
|
|
8138
8138
|
const factories = createAnimationFactories.call(this, prevTarget, animationOptions, controlDelay);
|
|
8139
|
-
const { getChildAnimations, childAnimations } = setupChildAnimations.call(this, transition,
|
|
8139
|
+
const { getChildAnimations, childAnimations } = setupChildAnimations.call(this, transition, this.activeStates, isFallback);
|
|
8140
8140
|
return executeAnimations.call(this, factories, getChildAnimations, childAnimations, transition, controlActiveState);
|
|
8141
8141
|
}
|
|
8142
|
-
function resolveDirectAnimation(directAnimate, directTransition
|
|
8142
|
+
function resolveDirectAnimation(directAnimate, directTransition) {
|
|
8143
8143
|
const variant = resolveVariant(directAnimate, this.options.variants, this.options.custom);
|
|
8144
8144
|
if (!variant)
|
|
8145
|
-
return;
|
|
8145
|
+
return {};
|
|
8146
8146
|
const transition = { ...this.options.transition, ...directTransition || variant.transition };
|
|
8147
|
+
const animationOptions = {};
|
|
8147
8148
|
Object.entries(variant).forEach(([key, value]) => {
|
|
8148
8149
|
if (key === "transition")
|
|
8149
8150
|
return;
|
|
8150
8151
|
this.target[key] = value;
|
|
8151
8152
|
animationOptions[key] = getOptions(transition, key);
|
|
8152
8153
|
});
|
|
8154
|
+
return animationOptions;
|
|
8153
8155
|
}
|
|
8154
|
-
function resolveStateAnimation(controlActiveState,
|
|
8156
|
+
function resolveStateAnimation(controlActiveState, transition) {
|
|
8155
8157
|
if (controlActiveState)
|
|
8156
8158
|
this.activeStates = { ...this.activeStates, ...controlActiveState };
|
|
8159
|
+
const transitionOptions = {};
|
|
8157
8160
|
STATE_TYPES.forEach((name) => {
|
|
8158
8161
|
if (!this.activeStates[name] || isAnimationControls(this.options[name]))
|
|
8159
8162
|
return;
|
|
@@ -8161,14 +8164,15 @@ function resolveStateAnimation(controlActiveState, animationOptions) {
|
|
|
8161
8164
|
const variant = resolveVariant(definition, this.options.variants, this.options.custom);
|
|
8162
8165
|
if (!variant)
|
|
8163
8166
|
return;
|
|
8164
|
-
|
|
8167
|
+
Object.assign(transition, variant.transition);
|
|
8165
8168
|
Object.entries(variant).forEach(([key, value]) => {
|
|
8166
8169
|
if (key === "transition")
|
|
8167
8170
|
return;
|
|
8168
8171
|
this.target[key] = value;
|
|
8169
|
-
|
|
8172
|
+
transitionOptions[key] = getOptions(transition, key);
|
|
8170
8173
|
});
|
|
8171
8174
|
});
|
|
8175
|
+
return transitionOptions;
|
|
8172
8176
|
}
|
|
8173
8177
|
function createAnimationFactories(prevTarget, animationOptions, controlDelay) {
|
|
8174
8178
|
const factories = [];
|
|
@@ -8192,7 +8196,7 @@ function createAnimationFactories(prevTarget, animationOptions, controlDelay) {
|
|
|
8192
8196
|
}
|
|
8193
8197
|
function setupChildAnimations(transition, controlActiveState, isFallback) {
|
|
8194
8198
|
var _a;
|
|
8195
|
-
if (!((_a = this.visualElement.variantChildren) == null ? void 0 : _a.size) || controlActiveState)
|
|
8199
|
+
if (!((_a = this.visualElement.variantChildren) == null ? void 0 : _a.size) || !controlActiveState)
|
|
8196
8200
|
return { getChildAnimations: () => Promise.resolve(), childAnimations: [] };
|
|
8197
8201
|
const { staggerChildren = 0, staggerDirection = 1, delayChildren = 0 } = transition || {};
|
|
8198
8202
|
const maxStaggerDuration = (this.visualElement.variantChildren.size - 1) * staggerChildren;
|
|
@@ -8239,7 +8243,7 @@ function executeAnimations(factories, getChildAnimations, childAnimations, trans
|
|
|
8239
8243
|
return controlActiveState ? getAnimationPromise : getAnimationPromise();
|
|
8240
8244
|
}
|
|
8241
8245
|
function isVariantLabels(value) {
|
|
8242
|
-
return typeof value === "string" || Array.isArray(value);
|
|
8246
|
+
return typeof value === "string" || value === false || Array.isArray(value);
|
|
8243
8247
|
}
|
|
8244
8248
|
const mountedStates = /* @__PURE__ */ new WeakMap();
|
|
8245
8249
|
let id = 0;
|
|
@@ -8262,16 +8266,16 @@ class MotionState {
|
|
|
8262
8266
|
this.parent = parent;
|
|
8263
8267
|
(_a = parent == null ? void 0 : parent.children) == null ? void 0 : _a.add(this);
|
|
8264
8268
|
this.depth = (parent == null ? void 0 : parent.depth) + 1 || 0;
|
|
8265
|
-
const initialVariantSource =
|
|
8269
|
+
const initialVariantSource = this.context.initial === false ? "animate" : "initial";
|
|
8266
8270
|
this.initTarget(initialVariantSource);
|
|
8267
8271
|
this.visualElement = createVisualElement(this.options.as, {
|
|
8268
8272
|
presenceContext: null,
|
|
8269
8273
|
parent: parent == null ? void 0 : parent.visualElement,
|
|
8270
8274
|
props: {
|
|
8271
8275
|
...this.options,
|
|
8272
|
-
whileHover: this.options.
|
|
8273
|
-
whileTap: this.options.
|
|
8274
|
-
whileInView: this.options.
|
|
8276
|
+
whileHover: this.options.whileHover,
|
|
8277
|
+
whileTap: this.options.whilePress,
|
|
8278
|
+
whileInView: this.options.whileInView
|
|
8275
8279
|
},
|
|
8276
8280
|
visualState: {
|
|
8277
8281
|
renderState: {
|
|
@@ -8446,7 +8450,15 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8446
8450
|
props: /* @__PURE__ */ vue.mergeDefaults({
|
|
8447
8451
|
as: {},
|
|
8448
8452
|
asChild: { type: Boolean },
|
|
8453
|
+
hover: {},
|
|
8454
|
+
press: {},
|
|
8455
|
+
inView: {},
|
|
8456
|
+
focus: {},
|
|
8449
8457
|
whileDrag: {},
|
|
8458
|
+
whileHover: {},
|
|
8459
|
+
whilePress: {},
|
|
8460
|
+
whileInView: {},
|
|
8461
|
+
whileFocus: {},
|
|
8450
8462
|
custom: {},
|
|
8451
8463
|
initial: { type: [String, Array, Object, Boolean] },
|
|
8452
8464
|
animate: {},
|
|
@@ -8470,15 +8482,12 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8470
8482
|
onLayoutAnimationStart: { type: Function },
|
|
8471
8483
|
onLayoutAnimationComplete: { type: Function },
|
|
8472
8484
|
globalPressTarget: { type: Boolean },
|
|
8473
|
-
press: {},
|
|
8474
8485
|
onPressStart: { type: Function },
|
|
8475
8486
|
onPress: { type: Function },
|
|
8476
8487
|
onPressCancel: { type: Function },
|
|
8477
|
-
hover: {},
|
|
8478
8488
|
onHoverStart: { type: Function },
|
|
8479
8489
|
onHoverEnd: { type: Function },
|
|
8480
8490
|
inViewOptions: {},
|
|
8481
|
-
inView: {},
|
|
8482
8491
|
onViewportEnter: { type: Function },
|
|
8483
8492
|
onViewportLeave: { type: Function },
|
|
8484
8493
|
drag: { type: [Boolean, String] },
|
|
@@ -8501,7 +8510,6 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8501
8510
|
onPanStart: { type: Function },
|
|
8502
8511
|
onPan: { type: Function },
|
|
8503
8512
|
onPanEnd: { type: Function },
|
|
8504
|
-
focus: {},
|
|
8505
8513
|
onFocus: { type: Function },
|
|
8506
8514
|
onBlur: { type: Function }
|
|
8507
8515
|
}, {
|
|
@@ -8519,7 +8527,31 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8519
8527
|
dragElastic: 0.5,
|
|
8520
8528
|
dragMomentum: true,
|
|
8521
8529
|
whileDrag: void 0,
|
|
8522
|
-
crossfade: true
|
|
8530
|
+
crossfade: true,
|
|
8531
|
+
whileHover: ({ hover: hover2 }) => {
|
|
8532
|
+
if (process.env.NODE_ENV === "development" && hover2) {
|
|
8533
|
+
vue.warn("hover is deprecated. Use whileHover instead.");
|
|
8534
|
+
}
|
|
8535
|
+
return hover2;
|
|
8536
|
+
},
|
|
8537
|
+
whilePress: ({ press: press2 }) => {
|
|
8538
|
+
if (process.env.NODE_ENV === "development" && press2) {
|
|
8539
|
+
vue.warn("press is deprecated. Use whilePress instead.");
|
|
8540
|
+
}
|
|
8541
|
+
return press2;
|
|
8542
|
+
},
|
|
8543
|
+
whileInView: ({ inView: inView2 }) => {
|
|
8544
|
+
if (process.env.NODE_ENV === "development" && inView2) {
|
|
8545
|
+
vue.warn("inView is deprecated. Use whileInView instead.");
|
|
8546
|
+
}
|
|
8547
|
+
return inView2;
|
|
8548
|
+
},
|
|
8549
|
+
whileFocus: ({ focus }) => {
|
|
8550
|
+
if (process.env.NODE_ENV === "development" && focus) {
|
|
8551
|
+
vue.warn("focus is deprecated. Use whileFocus instead.");
|
|
8552
|
+
}
|
|
8553
|
+
return focus;
|
|
8554
|
+
}
|
|
8523
8555
|
}),
|
|
8524
8556
|
setup(__props) {
|
|
8525
8557
|
const props = __props;
|
|
@@ -8541,6 +8573,7 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8541
8573
|
transition: props.transition ?? config.value.transition,
|
|
8542
8574
|
layoutGroup,
|
|
8543
8575
|
motionConfig: config.value,
|
|
8576
|
+
inViewOptions: props.inViewOptions ?? config.value.inViewOptions,
|
|
8544
8577
|
initial: animatePresenceContext.initial === false ? animatePresenceContext.initial : props.initial === true ? void 0 : props.initial
|
|
8545
8578
|
};
|
|
8546
8579
|
}
|
|
@@ -8581,7 +8614,7 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8581
8614
|
...isSVG ? {} : state2.visualElement.latestValues
|
|
8582
8615
|
};
|
|
8583
8616
|
if (isSVG) {
|
|
8584
|
-
const { attributes, style: style2 } = convertSvgStyleToAttributes(state2.target);
|
|
8617
|
+
const { attributes, style: style2 } = convertSvgStyleToAttributes(state2.isMounted() ? state2.target : state2.baseTarget);
|
|
8585
8618
|
Object.assign(attrsProps, attributes);
|
|
8586
8619
|
Object.assign(styleProps, style2);
|
|
8587
8620
|
}
|
|
@@ -8839,7 +8872,8 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8839
8872
|
props: {
|
|
8840
8873
|
transition: {},
|
|
8841
8874
|
reduceMotion: { default: defaultConfig.reduceMotion },
|
|
8842
|
-
nonce: {}
|
|
8875
|
+
nonce: {},
|
|
8876
|
+
inViewOptions: {}
|
|
8843
8877
|
},
|
|
8844
8878
|
setup(__props) {
|
|
8845
8879
|
const props = __props;
|
|
@@ -8847,7 +8881,8 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8847
8881
|
const config = vue.computed(() => ({
|
|
8848
8882
|
transition: props.transition ?? parentConfig.value.transition,
|
|
8849
8883
|
reduceMotion: props.reduceMotion ?? parentConfig.value.reduceMotion,
|
|
8850
|
-
nonce: props.nonce ?? parentConfig.value.nonce
|
|
8884
|
+
nonce: props.nonce ?? parentConfig.value.nonce,
|
|
8885
|
+
inViewOptions: props.inViewOptions ?? parentConfig.value.inViewOptions
|
|
8851
8886
|
}));
|
|
8852
8887
|
provideMotionConfig(config);
|
|
8853
8888
|
return (_ctx, _cache) => {
|
|
@@ -8904,7 +8939,15 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8904
8939
|
values: {},
|
|
8905
8940
|
as: { default: "ul" },
|
|
8906
8941
|
asChild: { type: Boolean },
|
|
8942
|
+
hover: {},
|
|
8943
|
+
press: {},
|
|
8944
|
+
inView: {},
|
|
8945
|
+
focus: {},
|
|
8907
8946
|
whileDrag: {},
|
|
8947
|
+
whileHover: {},
|
|
8948
|
+
whilePress: {},
|
|
8949
|
+
whileInView: {},
|
|
8950
|
+
whileFocus: {},
|
|
8908
8951
|
custom: {},
|
|
8909
8952
|
initial: { type: [String, Array, Object, Boolean] },
|
|
8910
8953
|
animate: {},
|
|
@@ -8928,15 +8971,12 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8928
8971
|
onLayoutAnimationStart: {},
|
|
8929
8972
|
onLayoutAnimationComplete: {},
|
|
8930
8973
|
globalPressTarget: { type: Boolean },
|
|
8931
|
-
press: {},
|
|
8932
8974
|
onPressStart: {},
|
|
8933
8975
|
onPress: {},
|
|
8934
8976
|
onPressCancel: {},
|
|
8935
|
-
hover: {},
|
|
8936
8977
|
onHoverStart: {},
|
|
8937
8978
|
onHoverEnd: {},
|
|
8938
8979
|
inViewOptions: {},
|
|
8939
|
-
inView: {},
|
|
8940
8980
|
onViewportEnter: {},
|
|
8941
8981
|
onViewportLeave: {},
|
|
8942
8982
|
drag: { type: [Boolean, String] },
|
|
@@ -8959,7 +8999,6 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8959
8999
|
onPanStart: {},
|
|
8960
9000
|
onPan: {},
|
|
8961
9001
|
onPanEnd: {},
|
|
8962
|
-
focus: {},
|
|
8963
9002
|
onFocus: {},
|
|
8964
9003
|
onBlur: {}
|
|
8965
9004
|
},
|
|
@@ -9228,7 +9267,15 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9228
9267
|
layout: { type: [Boolean, String], default: true },
|
|
9229
9268
|
as: { default: "li" },
|
|
9230
9269
|
asChild: { type: Boolean },
|
|
9270
|
+
hover: { default: void 0 },
|
|
9271
|
+
press: {},
|
|
9272
|
+
inView: { default: void 0 },
|
|
9273
|
+
focus: {},
|
|
9231
9274
|
whileDrag: { default: void 0 },
|
|
9275
|
+
whileHover: {},
|
|
9276
|
+
whilePress: {},
|
|
9277
|
+
whileInView: {},
|
|
9278
|
+
whileFocus: {},
|
|
9232
9279
|
custom: {},
|
|
9233
9280
|
initial: { type: [String, Array, Object, Boolean], default: void 0 },
|
|
9234
9281
|
animate: { default: void 0 },
|
|
@@ -9251,15 +9298,12 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9251
9298
|
onLayoutAnimationStart: {},
|
|
9252
9299
|
onLayoutAnimationComplete: {},
|
|
9253
9300
|
globalPressTarget: { type: Boolean },
|
|
9254
|
-
press: {},
|
|
9255
9301
|
onPressStart: {},
|
|
9256
9302
|
onPress: {},
|
|
9257
9303
|
onPressCancel: {},
|
|
9258
|
-
hover: { default: void 0 },
|
|
9259
9304
|
onHoverStart: {},
|
|
9260
9305
|
onHoverEnd: {},
|
|
9261
9306
|
inViewOptions: {},
|
|
9262
|
-
inView: { default: void 0 },
|
|
9263
9307
|
onViewportEnter: {},
|
|
9264
9308
|
onViewportLeave: {},
|
|
9265
9309
|
drag: { type: [Boolean, String] },
|
|
@@ -9282,7 +9326,6 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9282
9326
|
onPanStart: {},
|
|
9283
9327
|
onPan: {},
|
|
9284
9328
|
onPanEnd: {},
|
|
9285
|
-
focus: {},
|
|
9286
9329
|
onFocus: {},
|
|
9287
9330
|
onBlur: {}
|
|
9288
9331
|
},
|
|
@@ -20,8 +20,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_WithDefaults<
|
|
|
20
20
|
unwrapElement: boolean;
|
|
21
21
|
anchorX: string;
|
|
22
22
|
}>>>, {
|
|
23
|
-
initial: boolean;
|
|
24
23
|
mode: "wait" | "popLayout" | "sync";
|
|
24
|
+
initial: boolean;
|
|
25
25
|
multiple: boolean;
|
|
26
26
|
unwrapElement: boolean;
|
|
27
27
|
anchorX: "left" | "right";
|
|
@@ -3,10 +3,18 @@ import { ElementType, Options, SVGAttributesWithMotionValues, SetMotionValueType
|
|
|
3
3
|
export interface MotionProps<T extends ElementType = 'div', K = unknown> extends Options<K> {
|
|
4
4
|
as?: T;
|
|
5
5
|
asChild?: boolean;
|
|
6
|
+
hover?: Options['hover'];
|
|
7
|
+
press?: Options['press'];
|
|
8
|
+
inView?: Options['inView'];
|
|
9
|
+
focus?: Options['focus'];
|
|
6
10
|
whileDrag?: Options['whileDrag'];
|
|
11
|
+
whileHover?: Options['whileHover'];
|
|
12
|
+
whilePress?: Options['whilePress'];
|
|
13
|
+
whileInView?: Options['whileInView'];
|
|
14
|
+
whileFocus?: Options['whileFocus'];
|
|
7
15
|
}
|
|
8
16
|
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 & Readonly<import('vue').ExtractPropTypes<{}>>, never>, never> & (Omit<SetMotionValueType<IntrinsicElementAttributes, keyof SVGAttributesWithMotionValues>[T],
|
|
17
|
+
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], keyof Options<any> | "asChild"> & MotionProps<T, K>)> & import('vue').PublicProps;
|
|
10
18
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
11
19
|
attrs: any;
|
|
12
20
|
slots: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, mergeDefaults, useAttrs, getCurrentInstance, onBeforeMount, onMounted, onBeforeUnmount, onUnmounted, onBeforeUpdate, onUpdated, ref, openBlock, createBlock, unref, withCtx, renderSlot } from "vue";
|
|
1
|
+
import { defineComponent, mergeDefaults, warn, useAttrs, getCurrentInstance, onBeforeMount, onMounted, onBeforeUnmount, onUnmounted, onBeforeUpdate, onUpdated, ref, openBlock, createBlock, unref, withCtx, renderSlot } from "vue";
|
|
2
2
|
import { injectMotion, injectLayoutGroup, provideMotion } from "../context.mjs";
|
|
3
3
|
import { convertSvgStyleToAttributes, createStyles } from "../../state/style.mjs";
|
|
4
4
|
import { Primitive } from "./Primitive.mjs";
|
|
@@ -17,7 +17,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
17
17
|
props: /* @__PURE__ */ mergeDefaults({
|
|
18
18
|
as: {},
|
|
19
19
|
asChild: { type: Boolean },
|
|
20
|
+
hover: {},
|
|
21
|
+
press: {},
|
|
22
|
+
inView: {},
|
|
23
|
+
focus: {},
|
|
20
24
|
whileDrag: {},
|
|
25
|
+
whileHover: {},
|
|
26
|
+
whilePress: {},
|
|
27
|
+
whileInView: {},
|
|
28
|
+
whileFocus: {},
|
|
21
29
|
custom: {},
|
|
22
30
|
initial: { type: [String, Array, Object, Boolean] },
|
|
23
31
|
animate: {},
|
|
@@ -41,15 +49,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
41
49
|
onLayoutAnimationStart: { type: Function },
|
|
42
50
|
onLayoutAnimationComplete: { type: Function },
|
|
43
51
|
globalPressTarget: { type: Boolean },
|
|
44
|
-
press: {},
|
|
45
52
|
onPressStart: { type: Function },
|
|
46
53
|
onPress: { type: Function },
|
|
47
54
|
onPressCancel: { type: Function },
|
|
48
|
-
hover: {},
|
|
49
55
|
onHoverStart: { type: Function },
|
|
50
56
|
onHoverEnd: { type: Function },
|
|
51
57
|
inViewOptions: {},
|
|
52
|
-
inView: {},
|
|
53
58
|
onViewportEnter: { type: Function },
|
|
54
59
|
onViewportLeave: { type: Function },
|
|
55
60
|
drag: { type: [Boolean, String] },
|
|
@@ -72,7 +77,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
72
77
|
onPanStart: { type: Function },
|
|
73
78
|
onPan: { type: Function },
|
|
74
79
|
onPanEnd: { type: Function },
|
|
75
|
-
focus: {},
|
|
76
80
|
onFocus: { type: Function },
|
|
77
81
|
onBlur: { type: Function }
|
|
78
82
|
}, {
|
|
@@ -90,7 +94,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
90
94
|
dragElastic: 0.5,
|
|
91
95
|
dragMomentum: true,
|
|
92
96
|
whileDrag: void 0,
|
|
93
|
-
crossfade: true
|
|
97
|
+
crossfade: true,
|
|
98
|
+
whileHover: ({ hover }) => {
|
|
99
|
+
if (process.env.NODE_ENV === "development" && hover) {
|
|
100
|
+
warn("hover is deprecated. Use whileHover instead.");
|
|
101
|
+
}
|
|
102
|
+
return hover;
|
|
103
|
+
},
|
|
104
|
+
whilePress: ({ press }) => {
|
|
105
|
+
if (process.env.NODE_ENV === "development" && press) {
|
|
106
|
+
warn("press is deprecated. Use whilePress instead.");
|
|
107
|
+
}
|
|
108
|
+
return press;
|
|
109
|
+
},
|
|
110
|
+
whileInView: ({ inView }) => {
|
|
111
|
+
if (process.env.NODE_ENV === "development" && inView) {
|
|
112
|
+
warn("inView is deprecated. Use whileInView instead.");
|
|
113
|
+
}
|
|
114
|
+
return inView;
|
|
115
|
+
},
|
|
116
|
+
whileFocus: ({ focus }) => {
|
|
117
|
+
if (process.env.NODE_ENV === "development" && focus) {
|
|
118
|
+
warn("focus is deprecated. Use whileFocus instead.");
|
|
119
|
+
}
|
|
120
|
+
return focus;
|
|
121
|
+
}
|
|
94
122
|
}),
|
|
95
123
|
setup(__props) {
|
|
96
124
|
const props = __props;
|
|
@@ -112,6 +140,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
112
140
|
transition: props.transition ?? config.value.transition,
|
|
113
141
|
layoutGroup,
|
|
114
142
|
motionConfig: config.value,
|
|
143
|
+
inViewOptions: props.inViewOptions ?? config.value.inViewOptions,
|
|
115
144
|
initial: animatePresenceContext.initial === false ? animatePresenceContext.initial : props.initial === true ? void 0 : props.initial
|
|
116
145
|
};
|
|
117
146
|
}
|
|
@@ -152,7 +181,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
152
181
|
...isSVG ? {} : state.visualElement.latestValues
|
|
153
182
|
};
|
|
154
183
|
if (isSVG) {
|
|
155
|
-
const { attributes, style } = convertSvgStyleToAttributes(state.target);
|
|
184
|
+
const { attributes, style } = convertSvgStyleToAttributes(state.isMounted() ? state.target : state.baseTarget);
|
|
156
185
|
Object.assign(attrsProps, attributes);
|
|
157
186
|
Object.assign(styleProps, style);
|
|
158
187
|
}
|
|
@@ -7,9 +7,9 @@ declare function __VLS_template(): {
|
|
|
7
7
|
};
|
|
8
8
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
9
9
|
declare const __VLS_component: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<import('./types').MotionConfigState>, {
|
|
10
|
-
reduceMotion: "
|
|
10
|
+
reduceMotion: "always" | "user" | "never";
|
|
11
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: "
|
|
12
|
+
reduceMotion: "always" | "user" | "never";
|
|
13
13
|
}>>>, {
|
|
14
14
|
reduceMotion: "user" | "never" | "always";
|
|
15
15
|
}, {}>;
|
|
@@ -9,7 +9,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
9
9
|
props: {
|
|
10
10
|
transition: {},
|
|
11
11
|
reduceMotion: { default: defaultConfig.reduceMotion },
|
|
12
|
-
nonce: {}
|
|
12
|
+
nonce: {},
|
|
13
|
+
inViewOptions: {}
|
|
13
14
|
},
|
|
14
15
|
setup(__props) {
|
|
15
16
|
const props = __props;
|
|
@@ -17,7 +18,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
17
18
|
const config = computed(() => ({
|
|
18
19
|
transition: props.transition ?? parentConfig.value.transition,
|
|
19
20
|
reduceMotion: props.reduceMotion ?? parentConfig.value.reduceMotion,
|
|
20
|
-
nonce: props.nonce ?? parentConfig.value.nonce
|
|
21
|
+
nonce: props.nonce ?? parentConfig.value.nonce,
|
|
22
|
+
inViewOptions: props.inViewOptions ?? parentConfig.value.inViewOptions
|
|
21
23
|
}));
|
|
22
24
|
provideMotionConfig(config);
|
|
23
25
|
return (_ctx, _cache) => {
|
|
@@ -9,6 +9,8 @@ export interface MotionConfigState {
|
|
|
9
9
|
reduceMotion?: 'user' | 'never' | 'always';
|
|
10
10
|
/** Custom nonce for CSP compliance with inline styles */
|
|
11
11
|
nonce?: string;
|
|
12
|
+
/** Options for the inView prop */
|
|
13
|
+
inViewOptions?: Options['inViewOptions'];
|
|
12
14
|
}
|
|
13
15
|
/** Props interface matching the config state */
|
|
14
16
|
export type MotionConfigProps = MotionConfigState;
|
|
@@ -15,7 +15,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15
15
|
values: {},
|
|
16
16
|
as: { default: "ul" },
|
|
17
17
|
asChild: { type: Boolean },
|
|
18
|
+
hover: {},
|
|
19
|
+
press: {},
|
|
20
|
+
inView: {},
|
|
21
|
+
focus: {},
|
|
18
22
|
whileDrag: {},
|
|
23
|
+
whileHover: {},
|
|
24
|
+
whilePress: {},
|
|
25
|
+
whileInView: {},
|
|
26
|
+
whileFocus: {},
|
|
19
27
|
custom: {},
|
|
20
28
|
initial: { type: [String, Array, Object, Boolean] },
|
|
21
29
|
animate: {},
|
|
@@ -39,15 +47,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
39
47
|
onLayoutAnimationStart: {},
|
|
40
48
|
onLayoutAnimationComplete: {},
|
|
41
49
|
globalPressTarget: { type: Boolean },
|
|
42
|
-
press: {},
|
|
43
50
|
onPressStart: {},
|
|
44
51
|
onPress: {},
|
|
45
52
|
onPressCancel: {},
|
|
46
|
-
hover: {},
|
|
47
53
|
onHoverStart: {},
|
|
48
54
|
onHoverEnd: {},
|
|
49
55
|
inViewOptions: {},
|
|
50
|
-
inView: {},
|
|
51
56
|
onViewportEnter: {},
|
|
52
57
|
onViewportLeave: {},
|
|
53
58
|
drag: { type: [Boolean, String] },
|
|
@@ -70,7 +75,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
70
75
|
onPanStart: {},
|
|
71
76
|
onPan: {},
|
|
72
77
|
onPanEnd: {},
|
|
73
|
-
focus: {},
|
|
74
78
|
onFocus: {},
|
|
75
79
|
onBlur: {}
|
|
76
80
|
},
|
|
@@ -46,20 +46,20 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
|
|
|
46
46
|
whileDrag: any;
|
|
47
47
|
crossfade: boolean;
|
|
48
48
|
}>>>, {
|
|
49
|
+
as: keyof import('vue').IntrinsicElementAttributes;
|
|
50
|
+
initial: import('../../types').VariantLabels | import('../../types').Variant | boolean;
|
|
51
|
+
animate: import('../../types').VariantLabels | import('../../types').Variant | import('../../animation/types').AnimationControls;
|
|
49
52
|
layout: true | "position";
|
|
50
53
|
layoutId: string;
|
|
51
54
|
layoutScroll: boolean;
|
|
52
55
|
layoutRoot: boolean;
|
|
53
56
|
crossfade: boolean;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
inView: import('../../types').VariantLabels | import('../../types').Variant;
|
|
57
|
-
hover: import('../../types').VariantLabels | import('../../types').Variant;
|
|
58
|
-
whileDrag: import('../../types').Options["whileDrag"];
|
|
57
|
+
hover: import('../../types').Options["hover"];
|
|
58
|
+
inView: import('../../types').Options["inView"];
|
|
59
59
|
dragElastic: number;
|
|
60
60
|
dragMomentum: boolean;
|
|
61
61
|
dragListener: boolean;
|
|
62
|
-
|
|
62
|
+
whileDrag: import('../../types').Options["whileDrag"];
|
|
63
63
|
}, {}>, {
|
|
64
64
|
default?(_: {}): any;
|
|
65
65
|
}>;
|
|
@@ -15,7 +15,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15
15
|
layout: { type: [Boolean, String], default: true },
|
|
16
16
|
as: { default: "li" },
|
|
17
17
|
asChild: { type: Boolean },
|
|
18
|
+
hover: { default: void 0 },
|
|
19
|
+
press: {},
|
|
20
|
+
inView: { default: void 0 },
|
|
21
|
+
focus: {},
|
|
18
22
|
whileDrag: { default: void 0 },
|
|
23
|
+
whileHover: {},
|
|
24
|
+
whilePress: {},
|
|
25
|
+
whileInView: {},
|
|
26
|
+
whileFocus: {},
|
|
19
27
|
custom: {},
|
|
20
28
|
initial: { type: [String, Array, Object, Boolean], default: void 0 },
|
|
21
29
|
animate: { default: void 0 },
|
|
@@ -38,15 +46,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
38
46
|
onLayoutAnimationStart: {},
|
|
39
47
|
onLayoutAnimationComplete: {},
|
|
40
48
|
globalPressTarget: { type: Boolean },
|
|
41
|
-
press: {},
|
|
42
49
|
onPressStart: {},
|
|
43
50
|
onPress: {},
|
|
44
51
|
onPressCancel: {},
|
|
45
|
-
hover: { default: void 0 },
|
|
46
52
|
onHoverStart: {},
|
|
47
53
|
onHoverEnd: {},
|
|
48
54
|
inViewOptions: {},
|
|
49
|
-
inView: { default: void 0 },
|
|
50
55
|
onViewportEnter: {},
|
|
51
56
|
onViewportLeave: {},
|
|
52
57
|
drag: { type: [Boolean, String] },
|
|
@@ -69,7 +74,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
69
74
|
onPanStart: {},
|
|
70
75
|
onPan: {},
|
|
71
76
|
onPanEnd: {},
|
|
72
|
-
focus: {},
|
|
73
77
|
onFocus: {},
|
|
74
78
|
onBlur: {}
|
|
75
79
|
},
|
|
@@ -15,13 +15,13 @@ class FocusGesture extends Feature {
|
|
|
15
15
|
}
|
|
16
16
|
if (!isFocusVisible)
|
|
17
17
|
return;
|
|
18
|
-
this.state.setActive("
|
|
18
|
+
this.state.setActive("whileFocus", true);
|
|
19
19
|
this.isActive = true;
|
|
20
20
|
}
|
|
21
21
|
onBlur() {
|
|
22
22
|
if (!this.isActive)
|
|
23
23
|
return;
|
|
24
|
-
this.state.setActive("
|
|
24
|
+
this.state.setActive("whileFocus", false);
|
|
25
25
|
this.isActive = false;
|
|
26
26
|
}
|
|
27
27
|
mount() {
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { Variant, VariantLabels } from '../../../types';
|
|
2
2
|
export type FocusProps = {
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use `whileFocus` instead.
|
|
5
|
+
*/
|
|
3
6
|
focus?: VariantLabels | Variant;
|
|
7
|
+
/**
|
|
8
|
+
* Variant to apply when the element is focused.
|
|
9
|
+
*/
|
|
10
|
+
whileFocus?: VariantLabels | Variant;
|
|
4
11
|
onFocus?: (e: FocusEvent) => void;
|
|
5
12
|
onBlur?: (e: FocusEvent) => void;
|
|
6
13
|
};
|
|
@@ -5,8 +5,8 @@ import { frame } from "../../../external/.pnpm/framer-motion@11.16.6/external/fr
|
|
|
5
5
|
import { extractEventInfo } from "../press/index.mjs";
|
|
6
6
|
function handleHoverEvent(state, event, lifecycle) {
|
|
7
7
|
const props = state.options;
|
|
8
|
-
if (props.
|
|
9
|
-
state.setActive("
|
|
8
|
+
if (props.whileHover) {
|
|
9
|
+
state.setActive("whileHover", lifecycle === "Start");
|
|
10
10
|
}
|
|
11
11
|
const eventName = `onHover${lifecycle}`;
|
|
12
12
|
const callback = props[eventName];
|
|
@@ -2,7 +2,14 @@ import { Variant, VariantLabels } from '../../../types';
|
|
|
2
2
|
import { EventInfo } from 'framer-motion';
|
|
3
3
|
export type HoverEvent = (event: MouseEvent, info: EventInfo) => void;
|
|
4
4
|
export interface HoverProps {
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use `whileHover` instead.
|
|
7
|
+
*/
|
|
5
8
|
hover?: VariantLabels | Variant;
|
|
9
|
+
/**
|
|
10
|
+
* Variant to apply when the element is hovered.
|
|
11
|
+
*/
|
|
12
|
+
whileHover?: VariantLabels | Variant;
|
|
6
13
|
onHoverStart?: HoverEvent;
|
|
7
14
|
onHoverEnd?: HoverEvent;
|
|
8
15
|
}
|
|
@@ -3,8 +3,8 @@ import { inView } from "../../../external/.pnpm/framer-motion@11.16.6/external/f
|
|
|
3
3
|
import { frame } from "../../../external/.pnpm/framer-motion@11.16.6/external/framer-motion/dist/es/frameloop/frame.mjs";
|
|
4
4
|
function handleHoverEvent(state, entry, lifecycle) {
|
|
5
5
|
const props = state.options;
|
|
6
|
-
if (props.
|
|
7
|
-
state.setActive("
|
|
6
|
+
if (props.whileInView) {
|
|
7
|
+
state.setActive("whileInView", lifecycle === "Enter");
|
|
8
8
|
}
|
|
9
9
|
const eventName = `onViewport${lifecycle}`;
|
|
10
10
|
const callback = props[eventName];
|
|
@@ -11,7 +11,14 @@ export interface InViewProps {
|
|
|
11
11
|
inViewOptions?: InViewOptions & {
|
|
12
12
|
once?: boolean;
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use `whileInView` instead.
|
|
16
|
+
*/
|
|
14
17
|
inView?: VariantLabels | Variant;
|
|
18
|
+
/**
|
|
19
|
+
* Variant to apply when the element is in view.
|
|
20
|
+
*/
|
|
21
|
+
whileInView?: VariantLabels | Variant;
|
|
15
22
|
onViewportEnter?: ViewportEventHandler;
|
|
16
23
|
onViewportLeave?: ViewportEventHandler;
|
|
17
24
|
}
|
|
@@ -12,8 +12,8 @@ function extractEventInfo(event) {
|
|
|
12
12
|
}
|
|
13
13
|
function handlePressEvent(state, event, lifecycle) {
|
|
14
14
|
const props = state.options;
|
|
15
|
-
if (props.
|
|
16
|
-
state.setActive("
|
|
15
|
+
if (props.whilePress) {
|
|
16
|
+
state.setActive("whilePress", lifecycle === "Start");
|
|
17
17
|
}
|
|
18
18
|
const eventName = `onPress${lifecycle === "End" ? "" : lifecycle}`;
|
|
19
19
|
const callback = props[eventName];
|
|
@@ -6,7 +6,14 @@ export interface PressProps {
|
|
|
6
6
|
* If `true`, the press gesture will attach its start listener to window.
|
|
7
7
|
*/
|
|
8
8
|
globalPressTarget?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use `whilePress` instead.
|
|
11
|
+
*/
|
|
9
12
|
press?: VariantLabels | Variant;
|
|
13
|
+
/**
|
|
14
|
+
* Variant to apply when the element is pressed.
|
|
15
|
+
*/
|
|
16
|
+
whilePress?: VariantLabels | Variant;
|
|
10
17
|
onPressStart?: PressEvent;
|
|
11
18
|
onPress?: PressEvent;
|
|
12
19
|
onPressCancel?: PressEvent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { $Transition, Options } from '../types';
|
|
2
2
|
import { MotionState } from './motion-state';
|
|
3
|
-
declare const STATE_TYPES: readonly ["initial", "animate", "
|
|
3
|
+
declare const STATE_TYPES: readonly ["initial", "animate", "whileInView", "whileHover", "whilePress", "whileDrag", "whileFocus", "exit"];
|
|
4
4
|
export type StateType = typeof STATE_TYPES[number];
|
|
5
5
|
/**
|
|
6
6
|
* ζ ΈεΏε¨η»ζ΄ζ°ε½ζ°,ε€ηζζε¨η»ηΆζεεεζ§θ‘
|
|
@@ -7,7 +7,7 @@ import { isAnimationControls } from "../animation/utils.mjs";
|
|
|
7
7
|
import { animate } from "../external/.pnpm/framer-motion@11.16.6/external/framer-motion/dist/es/animation/animate/index.mjs";
|
|
8
8
|
import { noop } from "../external/.pnpm/motion-utils@11.16.0/external/motion-utils/dist/es/noop.mjs";
|
|
9
9
|
import "../external/.pnpm/motion-utils@11.16.0/external/motion-utils/dist/es/errors.mjs";
|
|
10
|
-
const STATE_TYPES = ["initial", "animate", "
|
|
10
|
+
const STATE_TYPES = ["initial", "animate", "whileInView", "whileHover", "whilePress", "whileDrag", "whileFocus", "exit"];
|
|
11
11
|
function animateUpdates({
|
|
12
12
|
controlActiveState = void 0,
|
|
13
13
|
controlDelay = 0,
|
|
@@ -17,31 +17,34 @@ function animateUpdates({
|
|
|
17
17
|
} = {}) {
|
|
18
18
|
const prevTarget = this.target;
|
|
19
19
|
this.target = { ...this.baseTarget };
|
|
20
|
-
|
|
20
|
+
let animationOptions = {};
|
|
21
21
|
const transition = { ...this.options.transition };
|
|
22
22
|
if (directAnimate)
|
|
23
|
-
resolveDirectAnimation.call(this, directAnimate, directTransition, animationOptions);
|
|
23
|
+
animationOptions = resolveDirectAnimation.call(this, directAnimate, directTransition, animationOptions);
|
|
24
24
|
else
|
|
25
|
-
resolveStateAnimation.call(this, controlActiveState,
|
|
25
|
+
animationOptions = resolveStateAnimation.call(this, controlActiveState, transition);
|
|
26
26
|
const factories = createAnimationFactories.call(this, prevTarget, animationOptions, controlDelay);
|
|
27
|
-
const { getChildAnimations, childAnimations } = setupChildAnimations.call(this, transition,
|
|
27
|
+
const { getChildAnimations, childAnimations } = setupChildAnimations.call(this, transition, this.activeStates, isFallback);
|
|
28
28
|
return executeAnimations.call(this, factories, getChildAnimations, childAnimations, transition, controlActiveState);
|
|
29
29
|
}
|
|
30
|
-
function resolveDirectAnimation(directAnimate, directTransition
|
|
30
|
+
function resolveDirectAnimation(directAnimate, directTransition) {
|
|
31
31
|
const variant = resolveVariant(directAnimate, this.options.variants, this.options.custom);
|
|
32
32
|
if (!variant)
|
|
33
|
-
return;
|
|
33
|
+
return {};
|
|
34
34
|
const transition = { ...this.options.transition, ...directTransition || variant.transition };
|
|
35
|
+
const animationOptions = {};
|
|
35
36
|
Object.entries(variant).forEach(([key, value]) => {
|
|
36
37
|
if (key === "transition")
|
|
37
38
|
return;
|
|
38
39
|
this.target[key] = value;
|
|
39
40
|
animationOptions[key] = getOptions(transition, key);
|
|
40
41
|
});
|
|
42
|
+
return animationOptions;
|
|
41
43
|
}
|
|
42
|
-
function resolveStateAnimation(controlActiveState,
|
|
44
|
+
function resolveStateAnimation(controlActiveState, transition) {
|
|
43
45
|
if (controlActiveState)
|
|
44
46
|
this.activeStates = { ...this.activeStates, ...controlActiveState };
|
|
47
|
+
const transitionOptions = {};
|
|
45
48
|
STATE_TYPES.forEach((name) => {
|
|
46
49
|
if (!this.activeStates[name] || isAnimationControls(this.options[name]))
|
|
47
50
|
return;
|
|
@@ -49,14 +52,15 @@ function resolveStateAnimation(controlActiveState, animationOptions) {
|
|
|
49
52
|
const variant = resolveVariant(definition, this.options.variants, this.options.custom);
|
|
50
53
|
if (!variant)
|
|
51
54
|
return;
|
|
52
|
-
|
|
55
|
+
Object.assign(transition, variant.transition);
|
|
53
56
|
Object.entries(variant).forEach(([key, value]) => {
|
|
54
57
|
if (key === "transition")
|
|
55
58
|
return;
|
|
56
59
|
this.target[key] = value;
|
|
57
|
-
|
|
60
|
+
transitionOptions[key] = getOptions(transition, key);
|
|
58
61
|
});
|
|
59
62
|
});
|
|
63
|
+
return transitionOptions;
|
|
60
64
|
}
|
|
61
65
|
function createAnimationFactories(prevTarget, animationOptions, controlDelay) {
|
|
62
66
|
const factories = [];
|
|
@@ -80,7 +84,7 @@ function createAnimationFactories(prevTarget, animationOptions, controlDelay) {
|
|
|
80
84
|
}
|
|
81
85
|
function setupChildAnimations(transition, controlActiveState, isFallback) {
|
|
82
86
|
var _a;
|
|
83
|
-
if (!((_a = this.visualElement.variantChildren) == null ? void 0 : _a.size) || controlActiveState)
|
|
87
|
+
if (!((_a = this.visualElement.variantChildren) == null ? void 0 : _a.size) || !controlActiveState)
|
|
84
88
|
return { getChildAnimations: () => Promise.resolve(), childAnimations: [] };
|
|
85
89
|
const { staggerChildren = 0, staggerDirection = 1, delayChildren = 0 } = transition || {};
|
|
86
90
|
const maxStaggerDuration = (this.visualElement.variantChildren.size - 1) * staggerChildren;
|
|
@@ -28,16 +28,16 @@ class MotionState {
|
|
|
28
28
|
this.parent = parent;
|
|
29
29
|
(_a = parent == null ? void 0 : parent.children) == null ? void 0 : _a.add(this);
|
|
30
30
|
this.depth = (parent == null ? void 0 : parent.depth) + 1 || 0;
|
|
31
|
-
const initialVariantSource =
|
|
31
|
+
const initialVariantSource = this.context.initial === false ? "animate" : "initial";
|
|
32
32
|
this.initTarget(initialVariantSource);
|
|
33
33
|
this.visualElement = createVisualElement(this.options.as, {
|
|
34
34
|
presenceContext: null,
|
|
35
35
|
parent: parent == null ? void 0 : parent.visualElement,
|
|
36
36
|
props: {
|
|
37
37
|
...this.options,
|
|
38
|
-
whileHover: this.options.
|
|
39
|
-
whileTap: this.options.
|
|
40
|
-
whileInView: this.options.
|
|
38
|
+
whileHover: this.options.whileHover,
|
|
39
|
+
whileTap: this.options.whilePress,
|
|
40
|
+
whileInView: this.options.whileInView
|
|
41
41
|
},
|
|
42
42
|
visualState: {
|
|
43
43
|
renderState: {
|
package/dist/es/types/state.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export interface Options<T = any> extends LayoutOptions, PressProps, HoverProps,
|
|
|
57
57
|
onUpdate?: (latest: ResolvedValues) => void;
|
|
58
58
|
}
|
|
59
59
|
export interface MotionStateContext {
|
|
60
|
-
initial?: VariantLabels;
|
|
60
|
+
initial?: VariantLabels | boolean;
|
|
61
61
|
animate?: VariantLabels;
|
|
62
62
|
inView?: VariantLabels;
|
|
63
63
|
hover?: VariantLabels;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const components = /* @__PURE__ */ new Set([
|
|
4
|
+
"Motion",
|
|
5
|
+
"AnimatePresence",
|
|
6
|
+
"LayoutGroup",
|
|
7
|
+
"MotionConfig",
|
|
8
|
+
"ReorderGroup",
|
|
9
|
+
"ReorderItem"
|
|
10
|
+
]);
|
|
11
|
+
function index() {
|
|
12
|
+
return {
|
|
13
|
+
type: "component",
|
|
14
|
+
resolve: (name) => {
|
|
15
|
+
if (components.has(name)) {
|
|
16
|
+
return {
|
|
17
|
+
name,
|
|
18
|
+
from: "motion-v"
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = index;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const components = /* @__PURE__ */ new Set([
|
|
2
|
+
"Motion",
|
|
3
|
+
"AnimatePresence",
|
|
4
|
+
"LayoutGroup",
|
|
5
|
+
"MotionConfig",
|
|
6
|
+
"ReorderGroup",
|
|
7
|
+
"ReorderItem"
|
|
8
|
+
]);
|
|
9
|
+
function index() {
|
|
10
|
+
return {
|
|
11
|
+
type: "component",
|
|
12
|
+
resolve: (name) => {
|
|
13
|
+
if (components.has(name)) {
|
|
14
|
+
return {
|
|
15
|
+
name,
|
|
16
|
+
from: "motion-v"
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { index as default };
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motion-v",
|
|
3
|
-
"version": "0.11.0
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"homepage": "https://github.com/
|
|
7
|
+
"homepage": "https://github.com/motiondivision/motion-vue",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/
|
|
10
|
+
"url": "https://github.com/motiondivision/motion-vue.git"
|
|
11
11
|
},
|
|
12
12
|
"keywords": [
|
|
13
13
|
"vue",
|
|
@@ -30,6 +30,16 @@
|
|
|
30
30
|
"types": "./dist/nuxt/index.d.cts",
|
|
31
31
|
"default": "./dist/nuxt/index.cjs"
|
|
32
32
|
}
|
|
33
|
+
},
|
|
34
|
+
"./resolver": {
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./dist/resolver/index.d.mts",
|
|
37
|
+
"default": "./dist/resolver/index.mjs"
|
|
38
|
+
},
|
|
39
|
+
"require": {
|
|
40
|
+
"types": "./dist/resolver/index.d.cts",
|
|
41
|
+
"default": "./dist/resolver/index.cjs"
|
|
42
|
+
}
|
|
33
43
|
}
|
|
34
44
|
},
|
|
35
45
|
"main": "./dist/cjs/index.js",
|