motion-v 1.8.0 → 1.8.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 CHANGED
@@ -6298,12 +6298,13 @@ function getValue(item) {
6298
6298
  return item.value;
6299
6299
  }
6300
6300
  function checkReorder(order2, value, offset, velocity) {
6301
- if (!velocity)
6302
- return order2;
6303
6301
  const index = order2.findIndex((item2) => item2.value === value);
6304
6302
  if (index === -1)
6305
6303
  return order2;
6306
- const nextOffset = velocity > 0 ? 1 : -1;
6304
+ const direction = velocity !== 0 ? velocity : offset;
6305
+ if (!direction)
6306
+ return order2;
6307
+ const nextOffset = direction > 0 ? 1 : -1;
6307
6308
  const nextItem = order2[index + nextOffset];
6308
6309
  if (!nextItem)
6309
6310
  return order2;
@@ -6416,8 +6417,12 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
6416
6417
  vue.onUpdated(() => {
6417
6418
  isReordering = false;
6418
6419
  });
6419
- vue.onBeforeUpdate(() => {
6420
- order2 = [];
6420
+ vue.watch(() => props.values, () => {
6421
+ if (!isReordering) {
6422
+ order2 = [];
6423
+ }
6424
+ }, {
6425
+ flush: "pre"
6421
6426
  });
6422
6427
  const groupRef = useDomRef();
6423
6428
  reorderContextProvider({
@@ -6439,6 +6444,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
6439
6444
  const newOrder = checkReorder(order2, item, offset, velocity);
6440
6445
  if (order2 !== newOrder) {
6441
6446
  isReordering = true;
6447
+ order2 = newOrder;
6442
6448
  (_a2 = props["onUpdate:values"]) == null ? void 0 : _a2.call(
6443
6449
  props,
6444
6450
  newOrder.map(getValue).filter((value) => props.values.includes(value))
@@ -6847,19 +6853,20 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
6847
6853
  var _a2, _b;
6848
6854
  const props = __props;
6849
6855
  const { style: style2 } = vue.toRefs(props);
6850
- const context = useReorderContext(null);
6856
+ const context = useReorderContext();
6851
6857
  const point2 = {
6852
6858
  x: useDefaultMotionValue((_a2 = style2.value) == null ? void 0 : _a2.x),
6853
6859
  y: useDefaultMotionValue((_b = style2.value) == null ? void 0 : _b.y)
6854
6860
  };
6855
6861
  const zIndex = useTransform([point2.x, point2.y], ([latestX, latestY]) => latestX || latestY ? 1 : "unset");
6856
6862
  function warning() {
6857
- heyListen.invariant(Boolean(context), "Reorder.Item must be a child of Reorder.Group");
6863
+ heyListen.invariant(Boolean(context), "Reorder.Item must be a descendant of Reorder.Group");
6858
6864
  }
6859
- const { axis, registerItem, updateOrder, groupRef } = context || {};
6865
+ warning();
6866
+ const { axis, registerItem, updateOrder, groupRef } = context;
6860
6867
  const attrs = vue.useAttrs();
6861
6868
  function bindProps() {
6862
- const { value, ...rest } = props;
6869
+ const { value, onDragStart, onDragEnd, onDrag, ...rest } = props;
6863
6870
  return {
6864
6871
  ...attrs,
6865
6872
  ...rest,
@@ -6879,6 +6886,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
6879
6886
  });
6880
6887
  const isDragging = vue.ref(false);
6881
6888
  function handleDrag(event, gesturePoint) {
6889
+ var _a3;
6882
6890
  const { velocity, point: pointerPoint } = gesturePoint;
6883
6891
  const offset = point2[axis.value].get();
6884
6892
  updateOrder(props.value, offset, velocity[axis.value]);
@@ -6888,16 +6896,18 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
6888
6896
  axis.value,
6889
6897
  velocity[axis.value]
6890
6898
  );
6891
- props.onDrag && props.onDrag(event, gesturePoint);
6899
+ if (!isDragging.value)
6900
+ isDragging.value = true;
6901
+ (_a3 = props.onDrag) == null ? void 0 : _a3.call(props, event, gesturePoint);
6892
6902
  }
6893
6903
  function handleDragEnd(event, gesturePoint) {
6904
+ var _a3;
6894
6905
  isDragging.value = false;
6895
6906
  resetAutoScrollState();
6896
- props.onDragEnd && props.onDragEnd(event, gesturePoint);
6907
+ (_a3 = props.onDragEnd) == null ? void 0 : _a3.call(props, event, gesturePoint);
6897
6908
  }
6898
6909
  function handleDragStart(event, gesturePoint) {
6899
6910
  var _a3;
6900
- isDragging.value = true;
6901
6911
  (_a3 = props.onDragStart) == null ? void 0 : _a3.call(props, event, gesturePoint);
6902
6912
  }
6903
6913
  return (_ctx, _cache) => {
@@ -6907,11 +6917,12 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
6907
6917
  onDrag: handleDrag,
6908
6918
  onDragEnd: handleDragEnd,
6909
6919
  onDragStart: handleDragStart,
6910
- onLayoutMeasure: _cache[0] || (_cache[0] = (measured) => vue.unref(registerItem)(_ctx.value, measured))
6920
+ onLayoutMeasure: _cache[0] || (_cache[0] = (measured) => {
6921
+ vue.unref(registerItem)(_ctx.value, measured);
6922
+ })
6911
6923
  }), {
6912
6924
  default: vue.withCtx(() => [
6913
- vue.renderSlot(_ctx.$slots, "default", { isDragging: isDragging.value }),
6914
- vue.createTextVNode(" " + vue.toDisplayString(warning()), 1)
6925
+ vue.renderSlot(_ctx.$slots, "default", { isDragging: isDragging.value })
6915
6926
  ]),
6916
6927
  _: 3
6917
6928
  }, 16, ["drag"]);
@@ -8,8 +8,8 @@ declare function __VLS_template(): {
8
8
  };
9
9
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
10
  declare const __VLS_component: import('vue').DefineComponent<AnimatePresenceProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<AnimatePresenceProps> & Readonly<{}>, {
11
- mode: "wait" | "popLayout" | "sync";
12
11
  initial: boolean;
12
+ mode: "wait" | "popLayout" | "sync";
13
13
  anchorX: "left" | "right";
14
14
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
15
15
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
@@ -11,57 +11,57 @@ export declare const MotionComponentProps: {
11
11
  default: boolean;
12
12
  };
13
13
  hover: {
14
- type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
14
+ type: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
15
15
  };
16
16
  press: {
17
- type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
17
+ type: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
18
18
  };
19
19
  inView: {
20
- type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
20
+ type: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
21
21
  };
22
22
  focus: {
23
- type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
23
+ type: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
24
24
  };
25
25
  whileDrag: {
26
- type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
26
+ type: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
27
27
  };
28
28
  whileHover: {
29
- type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
29
+ type: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
30
30
  default: ({ hover }: {
31
31
  hover: any;
32
32
  }) => any;
33
33
  };
34
34
  whilePress: {
35
- type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
35
+ type: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
36
36
  default: ({ press }: {
37
37
  press: any;
38
38
  }) => any;
39
39
  };
40
40
  whileInView: {
41
- type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
41
+ type: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
42
42
  default: ({ inView }: {
43
43
  inView: any;
44
44
  }) => any;
45
45
  };
46
46
  whileFocus: {
47
- type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
47
+ type: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
48
48
  default: ({ focus }: {
49
49
  focus: any;
50
50
  }) => any;
51
51
  };
52
52
  custom: {
53
- type: (ArrayConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[];
53
+ type: (ObjectConstructor | ArrayConstructor | StringConstructor | NumberConstructor)[];
54
54
  };
55
55
  initial: {
56
- type: (ArrayConstructor | BooleanConstructor | ObjectConstructor | StringConstructor)[];
56
+ type: (BooleanConstructor | ObjectConstructor | ArrayConstructor | StringConstructor)[];
57
57
  default: any;
58
58
  };
59
59
  animate: {
60
- type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
60
+ type: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
61
61
  default: any;
62
62
  };
63
63
  exit: {
64
- type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
64
+ type: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
65
65
  };
66
66
  variants: {
67
67
  type: ObjectConstructor;
@@ -13,7 +13,7 @@ export declare function useMotionState(props: MotionProps): {
13
13
  once?: boolean;
14
14
  };
15
15
  animatePresenceContext: import('../animate-presence/presence').PresenceContext;
16
- initial: false | import('framer-motion').VariantLabels | import('../..').VariantType;
16
+ initial: false | import('../..').VariantType | import('framer-motion').VariantLabels;
17
17
  as?: "div";
18
18
  asChild?: boolean;
19
19
  hover?: import('../..').Options["hover"];
@@ -27,26 +27,42 @@ export declare function useMotionState(props: MotionProps): {
27
27
  whileFocus?: import('../..').Options["whileFocus"];
28
28
  forwardMotionProps?: boolean;
29
29
  ignoreStrict?: boolean;
30
- layout?: boolean | "position" | "size" | "preserve-aspect";
31
- layoutScroll?: boolean;
32
- layoutRoot?: boolean;
33
- 'data-framer-portal-id'?: string;
34
- crossfade?: boolean;
35
- layoutDependency?: any;
36
- dragSnapToOrigin?: boolean;
37
- drag?: boolean | "x" | "y";
38
- animate?: import('framer-motion').VariantLabels | import('../..').VariantType | import('../../animation/types').AnimationControls;
39
- variants?: {
40
- [k: string]: import('../..').VariantType | ((custom: unknown) => import('../..').VariantType);
41
- };
42
- custom?: unknown;
43
30
  style?: Partial<{
44
31
  [x: `--${string}`]: string | number | import('framer-motion').MotionValue<any>;
45
32
  string?: string | number | import('framer-motion').MotionValue<any>;
46
- end?: string | number | import('framer-motion').MotionValue<any>;
33
+ clipPath?: string | number | import('framer-motion').MotionValue<any>;
34
+ filter?: string | number | import('framer-motion').MotionValue<any>;
35
+ marker?: string | number | import('framer-motion').MotionValue<any>;
36
+ mask?: string | number | import('framer-motion').MotionValue<any>;
37
+ path?: string | number | import('framer-motion').MotionValue<any>;
38
+ transition?: string | number | import('framer-motion').MotionValue<any>;
39
+ values?: string | number | import('framer-motion').MotionValue<any>;
40
+ clear?: string | number | import('framer-motion').MotionValue<any>;
47
41
  x?: string | number | import('framer-motion').MotionValue<any>;
48
42
  y?: string | number | import('framer-motion').MotionValue<any>;
49
- transition?: string | number | import('framer-motion').MotionValue<any>;
43
+ resize?: string | number | import('framer-motion').MotionValue<any>;
44
+ readonly length?: string | number | import('framer-motion').MotionValue<any>;
45
+ fill?: string | number | import('framer-motion').MotionValue<any>;
46
+ z?: string | number | import('framer-motion').MotionValue<any>;
47
+ translateX?: string | number | import('framer-motion').MotionValue<any>;
48
+ translateY?: string | number | import('framer-motion').MotionValue<any>;
49
+ translateZ?: string | number | import('framer-motion').MotionValue<any>;
50
+ rotate?: string | number | import('framer-motion').MotionValue<any>;
51
+ rotateX?: string | number | import('framer-motion').MotionValue<any>;
52
+ rotateY?: string | number | import('framer-motion').MotionValue<any>;
53
+ rotateZ?: string | number | import('framer-motion').MotionValue<any>;
54
+ scale?: string | number | import('framer-motion').MotionValue<any>;
55
+ scaleX?: string | number | import('framer-motion').MotionValue<any>;
56
+ scaleY?: string | number | import('framer-motion').MotionValue<any>;
57
+ scaleZ?: string | number | import('framer-motion').MotionValue<any>;
58
+ skew?: string | number | import('framer-motion').MotionValue<any>;
59
+ skewX?: string | number | import('framer-motion').MotionValue<any>;
60
+ skewY?: string | number | import('framer-motion').MotionValue<any>;
61
+ originX?: string | number | import('framer-motion').MotionValue<any>;
62
+ originY?: string | number | import('framer-motion').MotionValue<any>;
63
+ originZ?: string | number | import('framer-motion').MotionValue<any>;
64
+ perspective?: string | number | import('framer-motion').MotionValue<any>;
65
+ transformPerspective?: string | number | import('framer-motion').MotionValue<any>;
50
66
  accentColor?: string | number | import('framer-motion').MotionValue<any>;
51
67
  alignContent?: string | number | import('framer-motion').MotionValue<any>;
52
68
  alignItems?: string | number | import('framer-motion').MotionValue<any>;
@@ -151,9 +167,7 @@ export declare function useMotionState(props: MotionProps): {
151
167
  breakInside?: string | number | import('framer-motion').MotionValue<any>;
152
168
  captionSide?: string | number | import('framer-motion').MotionValue<any>;
153
169
  caretColor?: string | number | import('framer-motion').MotionValue<any>;
154
- clear?: string | number | import('framer-motion').MotionValue<any>;
155
170
  clip?: string | number | import('framer-motion').MotionValue<any>;
156
- clipPath?: string | number | import('framer-motion').MotionValue<any>;
157
171
  clipRule?: string | number | import('framer-motion').MotionValue<any>;
158
172
  color?: string | number | import('framer-motion').MotionValue<any>;
159
173
  colorInterpolation?: string | number | import('framer-motion').MotionValue<any>;
@@ -193,10 +207,8 @@ export declare function useMotionState(props: MotionProps): {
193
207
  display?: string | number | import('framer-motion').MotionValue<any>;
194
208
  dominantBaseline?: string | number | import('framer-motion').MotionValue<any>;
195
209
  emptyCells?: string | number | import('framer-motion').MotionValue<any>;
196
- fill?: string | number | import('framer-motion').MotionValue<any>;
197
210
  fillOpacity?: string | number | import('framer-motion').MotionValue<any>;
198
211
  fillRule?: string | number | import('framer-motion').MotionValue<any>;
199
- filter?: string | number | import('framer-motion').MotionValue<any>;
200
212
  flex?: string | number | import('framer-motion').MotionValue<any>;
201
213
  flexBasis?: string | number | import('framer-motion').MotionValue<any>;
202
214
  flexDirection?: string | number | import('framer-motion').MotionValue<any>;
@@ -268,7 +280,6 @@ export declare function useMotionState(props: MotionProps): {
268
280
  justifyItems?: string | number | import('framer-motion').MotionValue<any>;
269
281
  justifySelf?: string | number | import('framer-motion').MotionValue<any>;
270
282
  left?: string | number | import('framer-motion').MotionValue<any>;
271
- readonly length?: string | number | import('framer-motion').MotionValue<any>;
272
283
  letterSpacing?: string | number | import('framer-motion').MotionValue<any>;
273
284
  lightingColor?: string | number | import('framer-motion').MotionValue<any>;
274
285
  lineBreak?: string | number | import('framer-motion').MotionValue<any>;
@@ -288,11 +299,9 @@ export declare function useMotionState(props: MotionProps): {
288
299
  marginLeft?: string | number | import('framer-motion').MotionValue<any>;
289
300
  marginRight?: string | number | import('framer-motion').MotionValue<any>;
290
301
  marginTop?: string | number | import('framer-motion').MotionValue<any>;
291
- marker?: string | number | import('framer-motion').MotionValue<any>;
292
302
  markerEnd?: string | number | import('framer-motion').MotionValue<any>;
293
303
  markerMid?: string | number | import('framer-motion').MotionValue<any>;
294
304
  markerStart?: string | number | import('framer-motion').MotionValue<any>;
295
- mask?: string | number | import('framer-motion').MotionValue<any>;
296
305
  maskClip?: string | number | import('framer-motion').MotionValue<any>;
297
306
  maskComposite?: string | number | import('framer-motion').MotionValue<any>;
298
307
  maskImage?: string | number | import('framer-motion').MotionValue<any>;
@@ -356,7 +365,6 @@ export declare function useMotionState(props: MotionProps): {
356
365
  pageBreakBefore?: string | number | import('framer-motion').MotionValue<any>;
357
366
  pageBreakInside?: string | number | import('framer-motion').MotionValue<any>;
358
367
  paintOrder?: string | number | import('framer-motion').MotionValue<any>;
359
- perspective?: string | number | import('framer-motion').MotionValue<any>;
360
368
  perspectiveOrigin?: string | number | import('framer-motion').MotionValue<any>;
361
369
  placeContent?: string | number | import('framer-motion').MotionValue<any>;
362
370
  placeItems?: string | number | import('framer-motion').MotionValue<any>;
@@ -366,14 +374,11 @@ export declare function useMotionState(props: MotionProps): {
366
374
  printColorAdjust?: string | number | import('framer-motion').MotionValue<any>;
367
375
  quotes?: string | number | import('framer-motion').MotionValue<any>;
368
376
  r?: string | number | import('framer-motion').MotionValue<any>;
369
- resize?: string | number | import('framer-motion').MotionValue<any>;
370
377
  right?: string | number | import('framer-motion').MotionValue<any>;
371
- rotate?: string | number | import('framer-motion').MotionValue<any>;
372
378
  rowGap?: string | number | import('framer-motion').MotionValue<any>;
373
379
  rubyPosition?: string | number | import('framer-motion').MotionValue<any>;
374
380
  rx?: string | number | import('framer-motion').MotionValue<any>;
375
381
  ry?: string | number | import('framer-motion').MotionValue<any>;
376
- scale?: string | number | import('framer-motion').MotionValue<any>;
377
382
  scrollBehavior?: string | number | import('framer-motion').MotionValue<any>;
378
383
  scrollMargin?: string | number | import('framer-motion').MotionValue<any>;
379
384
  scrollMarginBlock?: string | number | import('framer-motion').MotionValue<any>;
@@ -542,25 +547,6 @@ export declare function useMotionState(props: MotionProps): {
542
547
  writingMode?: string | number | import('framer-motion').MotionValue<any>;
543
548
  zIndex?: string | number | import('framer-motion').MotionValue<any>;
544
549
  zoom?: string | number | import('framer-motion').MotionValue<any>;
545
- z?: string | number | import('framer-motion').MotionValue<any>;
546
- originX?: string | number | import('framer-motion').MotionValue<any>;
547
- originY?: string | number | import('framer-motion').MotionValue<any>;
548
- originZ?: string | number | import('framer-motion').MotionValue<any>;
549
- translateX?: string | number | import('framer-motion').MotionValue<any>;
550
- translateY?: string | number | import('framer-motion').MotionValue<any>;
551
- translateZ?: string | number | import('framer-motion').MotionValue<any>;
552
- rotateX?: string | number | import('framer-motion').MotionValue<any>;
553
- rotateY?: string | number | import('framer-motion').MotionValue<any>;
554
- rotateZ?: string | number | import('framer-motion').MotionValue<any>;
555
- scaleX?: string | number | import('framer-motion').MotionValue<any>;
556
- scaleY?: string | number | import('framer-motion').MotionValue<any>;
557
- scaleZ?: string | number | import('framer-motion').MotionValue<any>;
558
- skewX?: string | number | import('framer-motion').MotionValue<any>;
559
- skewY?: string | number | import('framer-motion').MotionValue<any>;
560
- transformPerspective?: string | number | import('framer-motion').MotionValue<any>;
561
- pathLength?: string | number | import('framer-motion').MotionValue<any>;
562
- pathOffset?: string | number | import('framer-motion').MotionValue<any>;
563
- pathSpacing?: string | number | import('framer-motion').MotionValue<any>;
564
550
  accentHeight?: string | number | import('framer-motion').MotionValue<any>;
565
551
  accumulate?: string | number | import('framer-motion').MotionValue<any>;
566
552
  additive?: string | number | import('framer-motion').MotionValue<any>;
@@ -596,6 +582,7 @@ export declare function useMotionState(props: MotionProps): {
596
582
  edgeMode?: string | number | import('framer-motion').MotionValue<any>;
597
583
  elevation?: string | number | import('framer-motion').MotionValue<any>;
598
584
  enableBackground?: string | number | import('framer-motion').MotionValue<any>;
585
+ end?: string | number | import('framer-motion').MotionValue<any>;
599
586
  exponent?: string | number | import('framer-motion').MotionValue<any>;
600
587
  externalResourcesRequired?: string | number | import('framer-motion').MotionValue<any>;
601
588
  filterRes?: string | number | import('framer-motion').MotionValue<any>;
@@ -650,7 +637,7 @@ export declare function useMotionState(props: MotionProps): {
650
637
  overlinePosition?: string | number | import('framer-motion').MotionValue<any>;
651
638
  overlineThickness?: string | number | import('framer-motion').MotionValue<any>;
652
639
  panose1?: string | number | import('framer-motion').MotionValue<any>;
653
- path?: string | number | import('framer-motion').MotionValue<any>;
640
+ pathLength?: string | number | import('framer-motion').MotionValue<any>;
654
641
  patternContentUnits?: string | number | import('framer-motion').MotionValue<any>;
655
642
  patternTransform?: string | number | import('framer-motion').MotionValue<any>;
656
643
  patternUnits?: string | number | import('framer-motion').MotionValue<any>;
@@ -700,7 +687,6 @@ export declare function useMotionState(props: MotionProps): {
700
687
  unicodeRange?: string | number | import('framer-motion').MotionValue<any>;
701
688
  unitsPerEm?: string | number | import('framer-motion').MotionValue<any>;
702
689
  vAlphabetic?: string | number | import('framer-motion').MotionValue<any>;
703
- values?: string | number | import('framer-motion').MotionValue<any>;
704
690
  version?: string | number | import('framer-motion').MotionValue<any>;
705
691
  vertAdvY?: string | number | import('framer-motion').MotionValue<any>;
706
692
  vertOriginX?: string | number | import('framer-motion').MotionValue<any>;
@@ -731,44 +717,58 @@ export declare function useMotionState(props: MotionProps): {
731
717
  y2?: string | number | import('framer-motion').MotionValue<any>;
732
718
  yChannelSelector?: string | number | import('framer-motion').MotionValue<any>;
733
719
  zoomAndPan?: string | number | import('framer-motion').MotionValue<any>;
734
- skew?: string | number | import('framer-motion').MotionValue<any>;
720
+ pathOffset?: string | number | import('framer-motion').MotionValue<any>;
721
+ pathSpacing?: string | number | import('framer-motion').MotionValue<any>;
735
722
  }>;
723
+ animate?: import('framer-motion').VariantLabels | import('../..').VariantType | import('../../animation/types').AnimationControls;
724
+ custom?: unknown;
736
725
  exit?: import('framer-motion').VariantLabels | import('../..').VariantType;
737
- onHoverStart?: import('../../features/gestures/hover/types').HoverEvent;
738
- onHoverEnd?: import('../../features/gestures/hover/types').HoverEvent;
726
+ variants?: {
727
+ [k: string]: import('../..').VariantType | ((custom: unknown) => import('../..').VariantType);
728
+ };
729
+ inherit?: boolean;
730
+ transformTemplate?: (transform: import('framer-motion').TransformProperties, generatedTransform: string) => string;
731
+ onAnimationComplete?: (definition: import('../..').Options["animate"]) => void;
732
+ onUpdate?: (latest: import('framer-motion').ResolvedValues) => void;
733
+ onAnimationStart?: (definition: import('../..').Options["animate"]) => void;
734
+ layout?: boolean | "position" | "size" | "preserve-aspect";
735
+ layoutScroll?: boolean;
736
+ layoutRoot?: boolean;
737
+ 'data-framer-portal-id'?: string;
738
+ crossfade?: boolean;
739
+ layoutDependency?: any;
740
+ onBeforeLayoutMeasure?: (box: import('framer-motion').Box) => void;
741
+ onLayoutMeasure?: (box: import('framer-motion').Box, prevBox: import('framer-motion').Box) => void;
742
+ onLayoutAnimationStart?: () => void;
743
+ onLayoutAnimationComplete?: () => void;
744
+ globalPressTarget?: boolean;
739
745
  onPressStart?: import('../../features/gestures/press/types').PressEvent;
740
746
  onPress?: import('../../features/gestures/press/types').PressEvent;
741
747
  onPressCancel?: import('../../features/gestures/press/types').PressEvent;
748
+ onHoverStart?: import('../../features/gestures/hover/types').HoverEvent;
749
+ onHoverEnd?: import('../../features/gestures/hover/types').HoverEvent;
742
750
  onViewportEnter?: (entry: IntersectionObserverEntry | null) => void;
743
751
  onViewportLeave?: (entry: IntersectionObserverEntry | null) => void;
744
- dragControls?: import('../../features/gestures/drag/use-drag-controls').DragControls;
745
- onPanSessionStart?: (event: PointerEvent, info: import('../..').PanInfo) => void;
746
- onPanStart?: (event: PointerEvent, info: import('../..').PanInfo) => void;
747
- onPan?: (event: PointerEvent, info: import('../..').PanInfo) => void;
748
- onPanEnd?: (event: PointerEvent, info: import('../..').PanInfo) => void;
749
- onUpdate?: (latest: import('framer-motion').ResolvedValues) => void;
750
- dragConstraints?: false | Partial<import('framer-motion').BoundingBox> | HTMLElement;
751
- onDragTransitionEnd?: () => void;
752
- onDragEnd?: (event: PointerEvent, info: import('framer-motion').PanInfo) => void;
752
+ drag?: boolean | "x" | "y";
753
+ dragSnapToOrigin?: boolean;
754
+ dragDirectionLock?: boolean;
753
755
  dragPropagation?: boolean;
756
+ dragConstraints?: false | Partial<import('framer-motion').BoundingBox> | HTMLElement;
754
757
  dragElastic?: import('framer-motion').DragElastic;
755
- onMeasureDragConstraints?: (constraints: import('framer-motion').BoundingBox) => import('framer-motion').BoundingBox | void;
756
758
  dragMomentum?: boolean;
757
759
  dragTransition?: import('framer-motion').InertiaOptions;
758
- transformTemplate?: (transform: import('framer-motion').TransformProperties, generatedTransform: string) => string;
759
- dragDirectionLock?: boolean;
760
- inherit?: boolean;
761
- onAnimationComplete?: (definition: import('../..').Options["animate"]) => void;
762
- onAnimationStart?: (definition: import('../..').Options["animate"]) => void;
763
- onBeforeLayoutMeasure?: (box: import('framer-motion').Box) => void;
764
- onLayoutMeasure?: (box: import('framer-motion').Box, prevBox: import('framer-motion').Box) => void;
765
- onLayoutAnimationStart?: () => void;
766
- onLayoutAnimationComplete?: () => void;
767
- globalPressTarget?: boolean;
768
760
  dragListener?: boolean;
761
+ dragControls?: import('../../features/gestures/drag/use-drag-controls').DragControls;
769
762
  onDragStart?: (event: PointerEvent, info: import('framer-motion').PanInfo) => void;
763
+ onDragEnd?: (event: PointerEvent, info: import('framer-motion').PanInfo) => void;
770
764
  onDrag?: (event: PointerEvent, info: import('framer-motion').PanInfo) => void;
771
765
  onDirectionLock?: (axis: "x" | "y") => void;
766
+ onDragTransitionEnd?: () => void;
767
+ onMeasureDragConstraints?: (constraints: import('framer-motion').BoundingBox) => import('framer-motion').BoundingBox | void;
768
+ onPanSessionStart?: (event: PointerEvent, info: import('../..').PanInfo) => void;
769
+ onPanStart?: (event: PointerEvent, info: import('../..').PanInfo) => void;
770
+ onPan?: (event: PointerEvent, info: import('../..').PanInfo) => void;
771
+ onPanEnd?: (event: PointerEvent, info: import('../..').PanInfo) => void;
772
772
  onFocus?: (e: FocusEvent) => void;
773
773
  onBlur?: (e: FocusEvent) => void;
774
774
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent, toRefs, onUpdated, onBeforeUpdate, useAttrs, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString } from "vue";
1
+ import { defineComponent, toRefs, onUpdated, watch, useAttrs, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString } from "vue";
2
2
  import { Motion } from "../motion/index.mjs";
3
3
  import { invariant } from "hey-listen";
4
4
  import { reorderContextProvider } from "./context.mjs";
@@ -93,8 +93,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
93
93
  onUpdated(() => {
94
94
  isReordering = false;
95
95
  });
96
- onBeforeUpdate(() => {
97
- order = [];
96
+ watch(() => props.values, () => {
97
+ if (!isReordering) {
98
+ order = [];
99
+ }
100
+ }, {
101
+ flush: "pre"
98
102
  });
99
103
  const groupRef = useDomRef();
100
104
  reorderContextProvider({
@@ -116,6 +120,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
116
120
  const newOrder = checkReorder(order, item, offset, velocity);
117
121
  if (order !== newOrder) {
118
122
  isReordering = true;
123
+ order = newOrder;
119
124
  (_a = props["onUpdate:values"]) == null ? void 0 : _a.call(
120
125
  props,
121
126
  newOrder.map(getValue).filter((value) => props.values.includes(value))
@@ -1,4 +1,4 @@
1
- import { defineComponent, toRefs, useAttrs, computed, ref, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString } from "vue";
1
+ import { defineComponent, toRefs, useAttrs, computed, ref, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot } from "vue";
2
2
  import { Motion } from "../motion/index.mjs";
3
3
  import { useReorderContext } from "./context.mjs";
4
4
  import { useDefaultMotionValue } from "./utils.mjs";
@@ -85,19 +85,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
85
85
  var _a, _b;
86
86
  const props = __props;
87
87
  const { style } = toRefs(props);
88
- const context = useReorderContext(null);
88
+ const context = useReorderContext();
89
89
  const point = {
90
90
  x: useDefaultMotionValue((_a = style.value) == null ? void 0 : _a.x),
91
91
  y: useDefaultMotionValue((_b = style.value) == null ? void 0 : _b.y)
92
92
  };
93
93
  const zIndex = useTransform([point.x, point.y], ([latestX, latestY]) => latestX || latestY ? 1 : "unset");
94
94
  function warning() {
95
- invariant(Boolean(context), "Reorder.Item must be a child of Reorder.Group");
95
+ invariant(Boolean(context), "Reorder.Item must be a descendant of Reorder.Group");
96
96
  }
97
- const { axis, registerItem, updateOrder, groupRef } = context || {};
97
+ warning();
98
+ const { axis, registerItem, updateOrder, groupRef } = context;
98
99
  const attrs = useAttrs();
99
100
  function bindProps() {
100
- const { value, ...rest } = props;
101
+ const { value, onDragStart, onDragEnd, onDrag, ...rest } = props;
101
102
  return {
102
103
  ...attrs,
103
104
  ...rest,
@@ -117,6 +118,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
117
118
  });
118
119
  const isDragging = ref(false);
119
120
  function handleDrag(event, gesturePoint) {
121
+ var _a2;
120
122
  const { velocity, point: pointerPoint } = gesturePoint;
121
123
  const offset = point[axis.value].get();
122
124
  updateOrder(props.value, offset, velocity[axis.value]);
@@ -126,16 +128,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
126
128
  axis.value,
127
129
  velocity[axis.value]
128
130
  );
129
- props.onDrag && props.onDrag(event, gesturePoint);
131
+ if (!isDragging.value)
132
+ isDragging.value = true;
133
+ (_a2 = props.onDrag) == null ? void 0 : _a2.call(props, event, gesturePoint);
130
134
  }
131
135
  function handleDragEnd(event, gesturePoint) {
136
+ var _a2;
132
137
  isDragging.value = false;
133
138
  resetAutoScrollState();
134
- props.onDragEnd && props.onDragEnd(event, gesturePoint);
139
+ (_a2 = props.onDragEnd) == null ? void 0 : _a2.call(props, event, gesturePoint);
135
140
  }
136
141
  function handleDragStart(event, gesturePoint) {
137
142
  var _a2;
138
- isDragging.value = true;
139
143
  (_a2 = props.onDragStart) == null ? void 0 : _a2.call(props, event, gesturePoint);
140
144
  }
141
145
  return (_ctx, _cache) => {
@@ -145,11 +149,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
145
149
  onDrag: handleDrag,
146
150
  onDragEnd: handleDragEnd,
147
151
  onDragStart: handleDragStart,
148
- onLayoutMeasure: _cache[0] || (_cache[0] = (measured) => unref(registerItem)(_ctx.value, measured))
152
+ onLayoutMeasure: _cache[0] || (_cache[0] = (measured) => {
153
+ unref(registerItem)(_ctx.value, measured);
154
+ })
149
155
  }), {
150
156
  default: withCtx(() => [
151
- renderSlot(_ctx.$slots, "default", { isDragging: isDragging.value }),
152
- createTextVNode(" " + toDisplayString(warning()), 1)
157
+ renderSlot(_ctx.$slots, "default", { isDragging: isDragging.value })
153
158
  ]),
154
159
  _: 3
155
160
  }, 16, ["drag"]);