motion-v 0.11.3 → 0.12.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 +44 -71
- package/dist/es/components/animate-presence/AnimatePresence.d.ts +1 -4
- package/dist/es/components/animate-presence/AnimatePresence.vue.mjs +10 -6
- package/dist/es/components/animate-presence/types.d.ts +1 -2
- package/dist/es/components/reorder/Item.d.ts +15 -67
- package/dist/es/components/reorder/Item.vue.mjs +9 -3
- package/dist/es/components/reorder/index.d.ts +8940 -11
- package/dist/es/components/reorder/index.mjs +2 -2
- package/dist/es/features/feature-manager.mjs +0 -2
- package/dist/es/features/gestures/types.d.ts +2 -4
- package/dist/es/features/index.d.ts +0 -1
- package/dist/es/features/layout/layout.mjs +0 -4
- package/dist/es/state/animate-updates.mjs +20 -23
- package/dist/es/state/motion-state.mjs +1 -1
- package/dist/es/state/utils.mjs +0 -4
- package/dist/es/types/state.d.ts +4 -1
- package/dist/es/value/use-spring.d.ts +2 -2
- package/dist/es/value/use-transform.d.ts +2 -1
- package/package.json +1 -1
- package/dist/es/features/svg.d.ts +0 -5
- package/dist/es/features/svg.mjs +0 -31
package/dist/cjs/index.js
CHANGED
|
@@ -3295,7 +3295,7 @@ function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0,
|
|
|
3295
3295
|
}
|
|
3296
3296
|
return animations;
|
|
3297
3297
|
}
|
|
3298
|
-
function isSVGElement$
|
|
3298
|
+
function isSVGElement$1(element) {
|
|
3299
3299
|
return element instanceof SVGElement && element.tagName !== "svg";
|
|
3300
3300
|
}
|
|
3301
3301
|
const createAxisDelta = () => ({
|
|
@@ -4244,7 +4244,7 @@ function createDOMVisualElement(element) {
|
|
|
4244
4244
|
latestValues: {}
|
|
4245
4245
|
}
|
|
4246
4246
|
};
|
|
4247
|
-
const node = isSVGElement$
|
|
4247
|
+
const node = isSVGElement$1(element) ? new SVGVisualElement(options) : new HTMLVisualElement(options);
|
|
4248
4248
|
node.mount(element);
|
|
4249
4249
|
visualElementStore.set(element, node);
|
|
4250
4250
|
}
|
|
@@ -5117,9 +5117,6 @@ function shallowCompare(next, prev) {
|
|
|
5117
5117
|
}
|
|
5118
5118
|
return true;
|
|
5119
5119
|
}
|
|
5120
|
-
function getOptions(options, key) {
|
|
5121
|
-
return options[key] ? { ...options, ...options[key], [key]: void 0 } : { ...options };
|
|
5122
|
-
}
|
|
5123
5120
|
function isCssVar(name) {
|
|
5124
5121
|
return name == null ? void 0 : name.startsWith("--");
|
|
5125
5122
|
}
|
|
@@ -5185,7 +5182,7 @@ const svgElements = [
|
|
|
5185
5182
|
"textPath"
|
|
5186
5183
|
];
|
|
5187
5184
|
const svgElementSet = new Set(svgElements);
|
|
5188
|
-
function isSVGElement
|
|
5185
|
+
function isSVGElement(as) {
|
|
5189
5186
|
return svgElementSet.has(as);
|
|
5190
5187
|
}
|
|
5191
5188
|
function isAnimateChanged(oldOptions, newOptions) {
|
|
@@ -6424,32 +6421,6 @@ class DragGesture extends Feature {
|
|
|
6424
6421
|
this.removeListeners();
|
|
6425
6422
|
}
|
|
6426
6423
|
}
|
|
6427
|
-
function isSVGElement(element) {
|
|
6428
|
-
return element instanceof SVGElement && element.tagName !== "svg";
|
|
6429
|
-
}
|
|
6430
|
-
class SVGFeature extends Feature {
|
|
6431
|
-
mount() {
|
|
6432
|
-
const instance = this.state.element;
|
|
6433
|
-
if (!isSVGElement(instance)) {
|
|
6434
|
-
return;
|
|
6435
|
-
}
|
|
6436
|
-
const visualElement = this.state.visualElement;
|
|
6437
|
-
frame.read(() => {
|
|
6438
|
-
try {
|
|
6439
|
-
visualElement.renderState.dimensions = typeof instance.getBBox === "function" ? instance.getBBox() : instance.getBoundingClientRect();
|
|
6440
|
-
} catch (e) {
|
|
6441
|
-
visualElement.renderState.dimensions = {
|
|
6442
|
-
x: 0,
|
|
6443
|
-
y: 0,
|
|
6444
|
-
width: 0,
|
|
6445
|
-
height: 0
|
|
6446
|
-
};
|
|
6447
|
-
}
|
|
6448
|
-
});
|
|
6449
|
-
}
|
|
6450
|
-
unmount() {
|
|
6451
|
-
}
|
|
6452
|
-
}
|
|
6453
6424
|
function pixelsToPercent(pixels, axis) {
|
|
6454
6425
|
if (axis.max === axis.min)
|
|
6455
6426
|
return 0;
|
|
@@ -6562,16 +6533,12 @@ class LayoutFeature extends Feature {
|
|
|
6562
6533
|
}
|
|
6563
6534
|
}
|
|
6564
6535
|
unmount() {
|
|
6565
|
-
var _a, _b;
|
|
6566
6536
|
const layoutGroup = this.state.options.layoutGroup;
|
|
6567
6537
|
const projection = this.state.visualElement.projection;
|
|
6568
6538
|
if (projection) {
|
|
6569
6539
|
if (layoutGroup == null ? void 0 : layoutGroup.group) {
|
|
6570
6540
|
layoutGroup.group.remove(projection);
|
|
6571
6541
|
}
|
|
6572
|
-
if ((_b = (_a = projection.getStack()) == null ? void 0 : _a.lead) == null ? void 0 : _b.animationProgress) {
|
|
6573
|
-
return;
|
|
6574
|
-
}
|
|
6575
6542
|
this.didUpdate();
|
|
6576
6543
|
}
|
|
6577
6544
|
}
|
|
@@ -7056,7 +7023,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
7056
7023
|
mount(instance, isLayoutDirty = this.root.hasTreeAnimated) {
|
|
7057
7024
|
if (this.instance)
|
|
7058
7025
|
return;
|
|
7059
|
-
this.isSVG = isSVGElement$
|
|
7026
|
+
this.isSVG = isSVGElement$1(instance);
|
|
7060
7027
|
this.instance = instance;
|
|
7061
7028
|
const { layoutId, layout, visualElement } = this.options;
|
|
7062
7029
|
if (visualElement && !visualElement.current) {
|
|
@@ -8118,7 +8085,6 @@ class FeatureManager {
|
|
|
8118
8085
|
new HoverGesture(state2),
|
|
8119
8086
|
new PressGesture(state2),
|
|
8120
8087
|
new InViewGesture(state2),
|
|
8121
|
-
new SVGFeature(state2),
|
|
8122
8088
|
new LayoutFeature(state2),
|
|
8123
8089
|
new ProjectionFeature(state2),
|
|
8124
8090
|
new PanGesture(state2),
|
|
@@ -8184,7 +8150,7 @@ class AnimationFeature extends Feature {
|
|
|
8184
8150
|
}
|
|
8185
8151
|
}
|
|
8186
8152
|
function createVisualElement(Component, options) {
|
|
8187
|
-
return isSVGElement
|
|
8153
|
+
return isSVGElement(Component) ? new SVGVisualElement(options) : new HTMLVisualElement(options);
|
|
8188
8154
|
}
|
|
8189
8155
|
function motionEvent(name, target, isExit) {
|
|
8190
8156
|
return new CustomEvent(name, { detail: { target, isExit } });
|
|
@@ -8205,7 +8171,7 @@ function animateUpdates({
|
|
|
8205
8171
|
if (directAnimate)
|
|
8206
8172
|
animationOptions = resolveDirectAnimation.call(this, directAnimate, directTransition, animationOptions);
|
|
8207
8173
|
else
|
|
8208
|
-
animationOptions = resolveStateAnimation.call(this, controlActiveState
|
|
8174
|
+
animationOptions = resolveStateAnimation.call(this, controlActiveState);
|
|
8209
8175
|
const factories = createAnimationFactories.call(this, prevTarget, animationOptions, controlDelay);
|
|
8210
8176
|
const { getChildAnimations, childAnimations } = setupChildAnimations.call(this, transition, this.activeStates, isFallback);
|
|
8211
8177
|
return executeAnimations.call(this, {
|
|
@@ -8221,21 +8187,18 @@ function resolveDirectAnimation(directAnimate, directTransition) {
|
|
|
8221
8187
|
const variant = resolveVariant(directAnimate, this.options.variants, this.options.custom);
|
|
8222
8188
|
if (!variant)
|
|
8223
8189
|
return {};
|
|
8224
|
-
const transition =
|
|
8225
|
-
const animationOptions = {};
|
|
8190
|
+
const transition = variant.transition || directTransition || this.options.transition || {};
|
|
8226
8191
|
Object.entries(variant).forEach(([key, value]) => {
|
|
8227
8192
|
if (key === "transition")
|
|
8228
8193
|
return;
|
|
8229
8194
|
this.target[key] = value;
|
|
8230
|
-
animationOptions[key] = getOptions(transition, key);
|
|
8231
8195
|
});
|
|
8232
|
-
return
|
|
8196
|
+
return transition;
|
|
8233
8197
|
}
|
|
8234
|
-
function resolveStateAnimation(controlActiveState
|
|
8198
|
+
function resolveStateAnimation(controlActiveState) {
|
|
8235
8199
|
if (controlActiveState)
|
|
8236
8200
|
this.activeStates = { ...this.activeStates, ...controlActiveState };
|
|
8237
|
-
|
|
8238
|
-
let variantTransition = {};
|
|
8201
|
+
let variantTransition = this.options.transition;
|
|
8239
8202
|
let variant = {};
|
|
8240
8203
|
STATE_TYPES.forEach((name) => {
|
|
8241
8204
|
if (!this.activeStates[name] || isAnimationControls(this.options[name]))
|
|
@@ -8249,17 +8212,15 @@ function resolveStateAnimation(controlActiveState, transition) {
|
|
|
8249
8212
|
if (!resolvedVariant)
|
|
8250
8213
|
return;
|
|
8251
8214
|
if (name !== "initial")
|
|
8252
|
-
variantTransition = resolvedVariant.transition || this.options.transition;
|
|
8215
|
+
variantTransition = resolvedVariant.transition || this.options.transition || {};
|
|
8253
8216
|
variant = Object.assign(variant, resolvedVariant);
|
|
8254
8217
|
});
|
|
8255
|
-
Object.assign(transition, variantTransition);
|
|
8256
8218
|
Object.entries(variant).forEach(([key, value]) => {
|
|
8257
8219
|
if (key === "transition")
|
|
8258
8220
|
return;
|
|
8259
8221
|
this.target[key] = value;
|
|
8260
|
-
transitionOptions[key] = getOptions(transition, key);
|
|
8261
8222
|
});
|
|
8262
|
-
return
|
|
8223
|
+
return variantTransition;
|
|
8263
8224
|
}
|
|
8264
8225
|
function createAnimationFactories(prevTarget, animationOptions, controlDelay) {
|
|
8265
8226
|
const factories = [];
|
|
@@ -8268,16 +8229,18 @@ function createAnimationFactories(prevTarget, animationOptions, controlDelay) {
|
|
|
8268
8229
|
if (!hasChanged(prevTarget[key], this.target[key]))
|
|
8269
8230
|
return;
|
|
8270
8231
|
(_a = this.baseTarget)[key] ?? (_a[key] = style.get(this.element, key));
|
|
8271
|
-
const keyValue = this.target[key] === "none" ? transformResetValue[key] : this.target[key];
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8232
|
+
const keyValue = this.target[key] === "none" && core.isDef(transformResetValue[key]) ? transformResetValue[key] : this.target[key];
|
|
8233
|
+
factories.push(() => {
|
|
8234
|
+
var _a2;
|
|
8235
|
+
return animate(
|
|
8236
|
+
this.element,
|
|
8237
|
+
{ [key]: keyValue },
|
|
8238
|
+
{
|
|
8239
|
+
...animationOptions,
|
|
8240
|
+
delay: (((_a2 = animationOptions[key]) == null ? void 0 : _a2.delay) || (animationOptions == null ? void 0 : animationOptions.delay) || 0) + controlDelay
|
|
8241
|
+
}
|
|
8242
|
+
);
|
|
8243
|
+
});
|
|
8281
8244
|
});
|
|
8282
8245
|
return factories;
|
|
8283
8246
|
}
|
|
@@ -8434,7 +8397,7 @@ class MotionState {
|
|
|
8434
8397
|
this.updateOptions();
|
|
8435
8398
|
this.featureManager.mount();
|
|
8436
8399
|
if (!notAnimate && this.options.animate) {
|
|
8437
|
-
this.
|
|
8400
|
+
this.animateUpdates();
|
|
8438
8401
|
}
|
|
8439
8402
|
if (this.options.layoutId) {
|
|
8440
8403
|
mountedLayoutIds.add(this.options.layoutId);
|
|
@@ -8874,11 +8837,10 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8874
8837
|
props: {
|
|
8875
8838
|
mode: { default: "sync" },
|
|
8876
8839
|
initial: { type: Boolean, default: true },
|
|
8877
|
-
multiple: { type: Boolean, default: false },
|
|
8878
8840
|
as: {},
|
|
8879
8841
|
custom: {},
|
|
8880
8842
|
onExitComplete: {},
|
|
8881
|
-
unwrapElement: { type: Boolean, default: false },
|
|
8843
|
+
unwrapElement: { type: [Boolean, Function], default: false },
|
|
8882
8844
|
anchorX: { default: "left" }
|
|
8883
8845
|
},
|
|
8884
8846
|
setup(__props) {
|
|
@@ -8910,7 +8872,11 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8910
8872
|
});
|
|
8911
8873
|
function exit(el, done) {
|
|
8912
8874
|
if (props.unwrapElement) {
|
|
8913
|
-
|
|
8875
|
+
if (typeof props.unwrapElement === "function") {
|
|
8876
|
+
el = props.unwrapElement(el) || el;
|
|
8877
|
+
} else {
|
|
8878
|
+
el = el.firstElementChild || el;
|
|
8879
|
+
}
|
|
8914
8880
|
}
|
|
8915
8881
|
const state2 = mountedStates.get(el);
|
|
8916
8882
|
if (!state2) {
|
|
@@ -8949,7 +8915,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8949
8915
|
});
|
|
8950
8916
|
}
|
|
8951
8917
|
const transitionProps = vue.computed(() => {
|
|
8952
|
-
if (props.
|
|
8918
|
+
if (props.mode !== "wait") {
|
|
8953
8919
|
return {
|
|
8954
8920
|
tag: props.as
|
|
8955
8921
|
};
|
|
@@ -8959,7 +8925,8 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8959
8925
|
};
|
|
8960
8926
|
});
|
|
8961
8927
|
return (_ctx, _cache) => {
|
|
8962
|
-
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.
|
|
8928
|
+
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.mode === "wait" ? vue.Transition : vue.TransitionGroup), vue.mergeProps({ css: false }, transitionProps.value, {
|
|
8929
|
+
appear: "",
|
|
8963
8930
|
onEnter: enter,
|
|
8964
8931
|
onLeave: exit
|
|
8965
8932
|
}), {
|
|
@@ -9483,6 +9450,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9483
9450
|
}
|
|
9484
9451
|
return axis.value;
|
|
9485
9452
|
});
|
|
9453
|
+
const isDragging2 = vue.ref(false);
|
|
9486
9454
|
return (_ctx, _cache) => {
|
|
9487
9455
|
return vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$6), vue.mergeProps(bindProps(), {
|
|
9488
9456
|
drag: drag.value,
|
|
@@ -9490,12 +9458,17 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9490
9458
|
onDrag: _cache[0] || (_cache[0] = (event, gesturePoint) => {
|
|
9491
9459
|
const { velocity } = gesturePoint;
|
|
9492
9460
|
velocity[vue.unref(axis)] && vue.unref(updateOrder)(_ctx.value, point2[vue.unref(axis)].get(), velocity[vue.unref(axis)]);
|
|
9461
|
+
!isDragging2.value && (isDragging2.value = true);
|
|
9493
9462
|
_ctx.onDrag && _ctx.onDrag(event, gesturePoint);
|
|
9494
9463
|
}),
|
|
9495
|
-
|
|
9464
|
+
onDragEnd: _cache[1] || (_cache[1] = (event, gesturePoint) => {
|
|
9465
|
+
isDragging2.value = false;
|
|
9466
|
+
_ctx.onDragEnd && _ctx.onDragEnd(event, gesturePoint);
|
|
9467
|
+
}),
|
|
9468
|
+
onLayoutMeasure: _cache[2] || (_cache[2] = (measured) => vue.unref(registerItem)(_ctx.value, measured))
|
|
9496
9469
|
}), {
|
|
9497
9470
|
default: vue.withCtx(() => [
|
|
9498
|
-
vue.renderSlot(_ctx.$slots, "default"),
|
|
9471
|
+
vue.renderSlot(_ctx.$slots, "default", { isDragging: isDragging2.value }),
|
|
9499
9472
|
vue.createTextVNode(" " + vue.toDisplayString(warning2()), 1)
|
|
9500
9473
|
]),
|
|
9501
9474
|
_: 3
|
|
@@ -9506,8 +9479,8 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9506
9479
|
const ReorderGroup = _sfc_main$3;
|
|
9507
9480
|
const ReorderItem = _sfc_main$2;
|
|
9508
9481
|
const Reorder = {
|
|
9509
|
-
Group:
|
|
9510
|
-
Item:
|
|
9482
|
+
Group: _sfc_main$3,
|
|
9483
|
+
Item: _sfc_main$2
|
|
9511
9484
|
};
|
|
9512
9485
|
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
9513
9486
|
__name: "RowValue",
|
|
@@ -10,20 +10,17 @@ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
|
10
10
|
declare const __VLS_component: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<AnimatePresenceProps>, {
|
|
11
11
|
mode: string;
|
|
12
12
|
initial: boolean;
|
|
13
|
-
multiple: boolean;
|
|
14
13
|
unwrapElement: boolean;
|
|
15
14
|
anchorX: string;
|
|
16
15
|
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<AnimatePresenceProps>, {
|
|
17
16
|
mode: string;
|
|
18
17
|
initial: boolean;
|
|
19
|
-
multiple: boolean;
|
|
20
18
|
unwrapElement: boolean;
|
|
21
19
|
anchorX: string;
|
|
22
20
|
}>>>, {
|
|
23
21
|
initial: boolean;
|
|
24
22
|
mode: "wait" | "popLayout" | "sync";
|
|
25
|
-
|
|
26
|
-
unwrapElement: boolean;
|
|
23
|
+
unwrapElement: boolean | ((el: HTMLElement) => HTMLElement);
|
|
27
24
|
anchorX: "left" | "right";
|
|
28
25
|
}, {}>;
|
|
29
26
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, onMounted, onUnmounted, computed, openBlock, createBlock, resolveDynamicComponent,
|
|
1
|
+
import { defineComponent, onMounted, onUnmounted, computed, openBlock, createBlock, resolveDynamicComponent, Transition, TransitionGroup, 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";
|
|
@@ -12,11 +12,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12
12
|
props: {
|
|
13
13
|
mode: { default: "sync" },
|
|
14
14
|
initial: { type: Boolean, default: true },
|
|
15
|
-
multiple: { type: Boolean, default: false },
|
|
16
15
|
as: {},
|
|
17
16
|
custom: {},
|
|
18
17
|
onExitComplete: {},
|
|
19
|
-
unwrapElement: { type: Boolean, default: false },
|
|
18
|
+
unwrapElement: { type: [Boolean, Function], default: false },
|
|
20
19
|
anchorX: { default: "left" }
|
|
21
20
|
},
|
|
22
21
|
setup(__props) {
|
|
@@ -48,7 +47,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
48
47
|
});
|
|
49
48
|
function exit(el, done) {
|
|
50
49
|
if (props.unwrapElement) {
|
|
51
|
-
|
|
50
|
+
if (typeof props.unwrapElement === "function") {
|
|
51
|
+
el = props.unwrapElement(el) || el;
|
|
52
|
+
} else {
|
|
53
|
+
el = el.firstElementChild || el;
|
|
54
|
+
}
|
|
52
55
|
}
|
|
53
56
|
const state = mountedStates.get(el);
|
|
54
57
|
if (!state) {
|
|
@@ -87,7 +90,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
87
90
|
});
|
|
88
91
|
}
|
|
89
92
|
const transitionProps = computed(() => {
|
|
90
|
-
if (props.
|
|
93
|
+
if (props.mode !== "wait") {
|
|
91
94
|
return {
|
|
92
95
|
tag: props.as
|
|
93
96
|
};
|
|
@@ -97,7 +100,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
97
100
|
};
|
|
98
101
|
});
|
|
99
102
|
return (_ctx, _cache) => {
|
|
100
|
-
return openBlock(), createBlock(resolveDynamicComponent(_ctx.
|
|
103
|
+
return openBlock(), createBlock(resolveDynamicComponent(_ctx.mode === "wait" ? Transition : TransitionGroup), mergeProps({ css: false }, transitionProps.value, {
|
|
104
|
+
appear: "",
|
|
101
105
|
onEnter: enter,
|
|
102
106
|
onLeave: exit
|
|
103
107
|
}), {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export interface AnimatePresenceProps {
|
|
2
2
|
mode?: 'wait' | 'popLayout' | 'sync';
|
|
3
3
|
initial?: boolean;
|
|
4
|
-
multiple?: boolean;
|
|
5
4
|
as?: string;
|
|
6
5
|
custom?: any;
|
|
7
6
|
onExitComplete?: VoidFunction;
|
|
8
|
-
unwrapElement?: boolean;
|
|
7
|
+
unwrapElement?: boolean | ((el: HTMLElement) => HTMLElement);
|
|
9
8
|
anchorX?: 'left' | 'right';
|
|
10
9
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MotionProps } from '../motion';
|
|
2
2
|
import { ElementType } from '../../types';
|
|
3
|
-
export interface GroupItemProps<T extends ElementType, K = unknown, V = unknown> extends MotionProps<T, K> {
|
|
3
|
+
export interface GroupItemProps<T extends ElementType = 'li', K = unknown, V = unknown> extends MotionProps<T, K> {
|
|
4
4
|
/**
|
|
5
5
|
* The value in the list that this component represents.
|
|
6
6
|
*
|
|
@@ -15,74 +15,22 @@ export interface GroupItemProps<T extends ElementType, K = unknown, V = unknown>
|
|
|
15
15
|
*/
|
|
16
16
|
layout?: true | 'position';
|
|
17
17
|
}
|
|
18
|
-
declare const _default:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
layoutScroll: boolean;
|
|
27
|
-
layoutRoot: boolean;
|
|
28
|
-
dragListener: boolean;
|
|
29
|
-
dragElastic: number;
|
|
30
|
-
dragMomentum: boolean;
|
|
31
|
-
whileDrag: any;
|
|
32
|
-
crossfade: boolean;
|
|
33
|
-
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<GroupItemProps<keyof import('vue').IntrinsicElementAttributes, unknown, unknown>>, {
|
|
34
|
-
layout: boolean;
|
|
35
|
-
as: ElementType;
|
|
36
|
-
initial: any;
|
|
37
|
-
animate: any;
|
|
38
|
-
hover: any;
|
|
39
|
-
inView: any;
|
|
40
|
-
layoutId: any;
|
|
41
|
-
layoutScroll: boolean;
|
|
42
|
-
layoutRoot: boolean;
|
|
43
|
-
dragListener: boolean;
|
|
44
|
-
dragElastic: number;
|
|
45
|
-
dragMomentum: boolean;
|
|
46
|
-
whileDrag: any;
|
|
47
|
-
crossfade: boolean;
|
|
48
|
-
}>>>, {
|
|
49
|
-
initial: import('../../types').VariantLabels | import('../../types').Variant | boolean;
|
|
50
|
-
animate: import('../../types').VariantLabels | import('../../types').Variant | import('../../animation/types').AnimationControls;
|
|
51
|
-
whileDrag: import('../../types').Options["whileDrag"];
|
|
52
|
-
layout: true | "position";
|
|
53
|
-
layoutId: string;
|
|
54
|
-
layoutScroll: boolean;
|
|
55
|
-
layoutRoot: boolean;
|
|
56
|
-
crossfade: boolean;
|
|
57
|
-
dragElastic: number;
|
|
58
|
-
dragMomentum: boolean;
|
|
59
|
-
dragListener: boolean;
|
|
60
|
-
as: keyof import('vue').IntrinsicElementAttributes;
|
|
61
|
-
hover: import('../../types').Options["hover"];
|
|
62
|
-
inView: import('../../types').Options["inView"];
|
|
63
|
-
}, {}>, {
|
|
64
|
-
default?(_: {}): any;
|
|
65
|
-
}>;
|
|
66
|
-
export default _default;
|
|
67
|
-
type __VLS_WithDefaults<P, D> = {
|
|
68
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
69
|
-
default: D[K];
|
|
70
|
-
}> : P[K];
|
|
71
|
-
};
|
|
72
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
73
|
-
type __VLS_TypePropsToOption<T> = {
|
|
74
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
75
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
76
|
-
} : {
|
|
77
|
-
type: import('vue').PropType<T[K]>;
|
|
78
|
-
required: true;
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
82
|
-
new (): {
|
|
83
|
-
$slots: S;
|
|
18
|
+
declare const _default: <T extends ElementType = "li", K = unknown, V = 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<{
|
|
19
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<import('vue').ExtractPropTypes<{}>>, never>, never> & GroupItemProps<keyof import('vue').IntrinsicElementAttributes, unknown, unknown>> & import('vue').PublicProps;
|
|
20
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
21
|
+
attrs: any;
|
|
22
|
+
slots: {
|
|
23
|
+
default?(_: {
|
|
24
|
+
isDragging: boolean;
|
|
25
|
+
}): any;
|
|
84
26
|
};
|
|
27
|
+
emit: {};
|
|
28
|
+
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}> & {
|
|
31
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
85
32
|
};
|
|
33
|
+
export default _default;
|
|
86
34
|
type __VLS_PrettifyLocal<T> = {
|
|
87
35
|
[K in keyof T]: T[K];
|
|
88
36
|
} & {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, toRefs, useAttrs, computed, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString } from "vue";
|
|
1
|
+
import { defineComponent, toRefs, useAttrs, computed, ref, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString } from "vue";
|
|
2
2
|
import { useReorderContext } from "./context.mjs";
|
|
3
3
|
import { useDefaultMotionValue } from "./utils.mjs";
|
|
4
4
|
import { invariant } from "hey-listen";
|
|
@@ -110,6 +110,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
110
110
|
}
|
|
111
111
|
return axis.value;
|
|
112
112
|
});
|
|
113
|
+
const isDragging = ref(false);
|
|
113
114
|
return (_ctx, _cache) => {
|
|
114
115
|
return openBlock(), createBlock(unref(_sfc_main$1), mergeProps(bindProps(), {
|
|
115
116
|
drag: drag.value,
|
|
@@ -117,12 +118,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
117
118
|
onDrag: _cache[0] || (_cache[0] = (event, gesturePoint) => {
|
|
118
119
|
const { velocity } = gesturePoint;
|
|
119
120
|
velocity[unref(axis)] && unref(updateOrder)(_ctx.value, point[unref(axis)].get(), velocity[unref(axis)]);
|
|
121
|
+
!isDragging.value && (isDragging.value = true);
|
|
120
122
|
_ctx.onDrag && _ctx.onDrag(event, gesturePoint);
|
|
121
123
|
}),
|
|
122
|
-
|
|
124
|
+
onDragEnd: _cache[1] || (_cache[1] = (event, gesturePoint) => {
|
|
125
|
+
isDragging.value = false;
|
|
126
|
+
_ctx.onDragEnd && _ctx.onDragEnd(event, gesturePoint);
|
|
127
|
+
}),
|
|
128
|
+
onLayoutMeasure: _cache[2] || (_cache[2] = (measured) => unref(registerItem)(_ctx.value, measured))
|
|
123
129
|
}), {
|
|
124
130
|
default: withCtx(() => [
|
|
125
|
-
renderSlot(_ctx.$slots, "default"),
|
|
131
|
+
renderSlot(_ctx.$slots, "default", { isDragging: isDragging.value }),
|
|
126
132
|
createTextVNode(" " + toDisplayString(warning()), 1)
|
|
127
133
|
]),
|
|
128
134
|
_: 3
|