motion-v 0.8.0 → 0.9.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/dist/cjs/index.js CHANGED
@@ -6398,8 +6398,12 @@ class LayoutFeature extends Feature {
6398
6398
  this.state.willUpdate("beforeUpdate");
6399
6399
  }
6400
6400
  update() {
6401
- var _a;
6402
- (_a = this.state.visualElement.projection) == null ? void 0 : _a.root.didUpdate();
6401
+ this.didUpdate();
6402
+ }
6403
+ didUpdate() {
6404
+ var _a, _b;
6405
+ if (this.state.options.layout || this.state.options.layoutId)
6406
+ (_b = (_a = this.state.visualElement.projection) == null ? void 0 : _a.root) == null ? void 0 : _b.didUpdate();
6403
6407
  }
6404
6408
  beforeMount() {
6405
6409
  }
@@ -6413,7 +6417,7 @@ class LayoutFeature extends Feature {
6413
6417
  (_a = layoutGroup == null ? void 0 : layoutGroup.group) == null ? void 0 : _a.add(projection);
6414
6418
  }
6415
6419
  globalProjectionState.hasEverUpdated = true;
6416
- projection == null ? void 0 : projection.root.didUpdate();
6420
+ this.didUpdate();
6417
6421
  }
6418
6422
  }
6419
6423
  beforeUnmount() {
@@ -6429,14 +6433,11 @@ class LayoutFeature extends Feature {
6429
6433
  }
6430
6434
  }
6431
6435
  unmount() {
6432
- var _a, _b;
6433
6436
  const layoutGroup = this.state.options.layoutGroup;
6434
6437
  const projection = this.state.visualElement.projection;
6435
6438
  if ((layoutGroup == null ? void 0 : layoutGroup.group) && projection)
6436
6439
  layoutGroup.group.remove(projection);
6437
- if (this.state.options.layoutId || this.state.options.layout) {
6438
- (_b = (_a = this.state.visualElement.projection) == null ? void 0 : _a.root) == null ? void 0 : _b.didUpdate();
6439
- }
6440
+ this.didUpdate();
6440
6441
  }
6441
6442
  }
6442
6443
  function asyncHandler(handler) {
@@ -7932,7 +7933,21 @@ class ProjectionFeature extends Feature {
7932
7933
  // initialPromotionConfig
7933
7934
  layoutRoot: options.layoutRoot,
7934
7935
  layoutScroll: options.layoutScroll,
7935
- crossfade: options.crossfade
7936
+ crossfade: options.crossfade,
7937
+ onExitComplete: () => {
7938
+ var _a;
7939
+ if (!((_a = this.state.visualElement.projection) == null ? void 0 : _a.isPresent)) {
7940
+ const done = doneCallbacks.get(this.state.element);
7941
+ this.state.isSafeToRemove = true;
7942
+ if (done) {
7943
+ done({
7944
+ detail: {
7945
+ isExit: true
7946
+ }
7947
+ }, true);
7948
+ }
7949
+ }
7950
+ }
7936
7951
  });
7937
7952
  }
7938
7953
  update() {
@@ -8229,6 +8244,9 @@ class MotionState {
8229
8244
  // Initialize animation target values
8230
8245
  initTarget(initialVariantSource) {
8231
8246
  this.baseTarget = resolveVariant(this.options[initialVariantSource] || this.context[initialVariantSource], this.options.variants) || {};
8247
+ for (const key in this.baseTarget) {
8248
+ this.visualElement.setStaticValue(key, this.baseTarget[key]);
8249
+ }
8232
8250
  this.target = {};
8233
8251
  }
8234
8252
  // Get initial animation state
@@ -8265,15 +8283,6 @@ class MotionState {
8265
8283
  }
8266
8284
  this.visualElement.state = this;
8267
8285
  this.updateOptions();
8268
- if (typeof this.initial === "object") {
8269
- for (const key in this.initial) {
8270
- this.visualElement.setStaticValue(key, this.initial[key]);
8271
- }
8272
- } else if (typeof this.initial === "string" && this.options.variants) {
8273
- for (const key in this.options.variants[this.initial]) {
8274
- this.visualElement.setStaticValue(key, this.options.variants[this.initial][key]);
8275
- }
8276
- }
8277
8286
  this.featureManager.mount();
8278
8287
  if (!notAnimate && this.options.animate) {
8279
8288
  this.animateUpdates();
@@ -8345,7 +8354,8 @@ class MotionState {
8345
8354
  }
8346
8355
  willUpdate(label) {
8347
8356
  var _a;
8348
- (_a = this.visualElement.projection) == null ? void 0 : _a.willUpdate();
8357
+ if (this.options.layout || this.options.layoutId)
8358
+ (_a = this.visualElement.projection) == null ? void 0 : _a.willUpdate();
8349
8359
  }
8350
8360
  }
8351
8361
  function getMotionElement(el) {
@@ -8368,7 +8378,7 @@ const [injectMotionConfig, provideMotionConfig] = createContext("MotionConfig");
8368
8378
  function useMotionConfig() {
8369
8379
  return injectMotionConfig(vue.computed(() => defaultConfig));
8370
8380
  }
8371
- const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
8381
+ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
8372
8382
  ...{
8373
8383
  name: "Motion",
8374
8384
  inheritAttrs: false
@@ -8396,6 +8406,10 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
8396
8406
  layoutRoot: { type: Boolean },
8397
8407
  "data-framer-portal-id": {},
8398
8408
  crossfade: { type: Boolean },
8409
+ onBeforeLayoutMeasure: { type: Function },
8410
+ onLayoutMeasure: { type: Function },
8411
+ onLayoutAnimationStart: { type: Function },
8412
+ onLayoutAnimationComplete: { type: Function },
8399
8413
  globalPressTarget: { type: Boolean },
8400
8414
  press: {},
8401
8415
  onPressStart: { type: Function },
@@ -8557,7 +8571,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
8557
8571
  }
8558
8572
  });
8559
8573
  const componentCache = /* @__PURE__ */ new Map();
8560
- const motion = new Proxy(_sfc_main$3, {
8574
+ const motion = new Proxy(_sfc_main$5, {
8561
8575
  get(target, prop) {
8562
8576
  if (typeof prop === "symbol")
8563
8577
  return target[prop];
@@ -8569,7 +8583,7 @@ const motion = new Proxy(_sfc_main$3, {
8569
8583
  name: `motion.${component.$name}`,
8570
8584
  setup(_, { attrs, slots }) {
8571
8585
  return () => {
8572
- return vue.h(_sfc_main$3, {
8586
+ return vue.h(_sfc_main$5, {
8573
8587
  ...attrs,
8574
8588
  as: component,
8575
8589
  asChild: false
@@ -8585,7 +8599,7 @@ const motion = new Proxy(_sfc_main$3, {
8585
8599
  name: `motion.${prop}`,
8586
8600
  setup(_, { attrs, slots }) {
8587
8601
  return () => {
8588
- return vue.h(_sfc_main$3, {
8602
+ return vue.h(_sfc_main$5, {
8589
8603
  ...attrs,
8590
8604
  as: prop,
8591
8605
  asChild: false
@@ -8649,7 +8663,7 @@ function usePopLayout(props) {
8649
8663
  styles
8650
8664
  };
8651
8665
  }
8652
- const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
8666
+ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
8653
8667
  ...{
8654
8668
  name: "AnimatePresence",
8655
8669
  inheritAttrs: true
@@ -8747,7 +8761,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
8747
8761
  };
8748
8762
  }
8749
8763
  });
8750
- const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
8764
+ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
8751
8765
  ...{
8752
8766
  name: "MotionConfig",
8753
8767
  inheritAttrs: false
@@ -8772,86 +8786,163 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
8772
8786
  };
8773
8787
  }
8774
8788
  });
8775
- function useForceUpdate() {
8776
- const key = vue.ref(0);
8777
- function forceUpdate() {
8778
- key.value++;
8779
- }
8780
- return [forceUpdate, key];
8781
- }
8782
- function notify(node) {
8783
- return !node.isLayoutDirty && node.willUpdate(false);
8784
- }
8785
- function nodeGroup() {
8786
- const nodes = /* @__PURE__ */ new Set();
8787
- const subscriptions = /* @__PURE__ */ new WeakMap();
8788
- const dirtyAll = () => nodes.forEach(notify);
8789
- return {
8790
- add: (node) => {
8791
- nodes.add(node);
8792
- subscriptions.set(
8793
- node,
8794
- node.addEventListener("willUpdate", dirtyAll)
8795
- );
8796
- },
8797
- remove: (node) => {
8798
- nodes.delete(node);
8799
- const unsubscribe = subscriptions.get(node);
8800
- if (unsubscribe) {
8801
- unsubscribe();
8802
- subscriptions.delete(node);
8803
- }
8804
- },
8805
- dirty: dirtyAll,
8806
- didUpdate: () => {
8807
- var _a;
8808
- (_a = nodes[0]) == null ? void 0 : _a.didUpdate();
8809
- }
8810
- };
8811
- }
8812
- function useLayoutGroupProvider(props) {
8813
- const parentGroup = injectLayoutGroup(null);
8814
- const [forceRender, key] = useForceUpdate();
8815
- const context = {
8816
- id: getGroupId(props, parentGroup),
8817
- group: getGroup(props, parentGroup),
8818
- forceRender,
8819
- key
8820
- };
8821
- provideLayoutGroup(context);
8822
- return context;
8823
- }
8824
- function useLayoutGroup() {
8825
- const { forceRender } = injectLayoutGroup({ forceRender: () => {
8826
- } });
8827
- return { forceRender };
8789
+ const [useReorderContext, reorderContextProvider] = createContext("ReorderContext");
8790
+ function compareMin(a, b) {
8791
+ return a.layout.min - b.layout.min;
8792
+ }
8793
+ function getValue(item) {
8794
+ return item.value;
8795
+ }
8796
+ function checkReorder(order2, value, offset, velocity) {
8797
+ if (!velocity)
8798
+ return order2;
8799
+ const index = order2.findIndex((item2) => item2.value === value);
8800
+ if (index === -1)
8801
+ return order2;
8802
+ const nextOffset = velocity > 0 ? 1 : -1;
8803
+ const nextItem = order2[index + nextOffset];
8804
+ if (!nextItem)
8805
+ return order2;
8806
+ const item = order2[index];
8807
+ const nextLayout = nextItem.layout;
8808
+ const nextItemCenter = mixNumber(nextLayout.min, nextLayout.max, 0.5);
8809
+ if (nextOffset === 1 && item.layout.max + offset > nextItemCenter || nextOffset === -1 && item.layout.min + offset < nextItemCenter) {
8810
+ return moveItem(order2, index, index + nextOffset);
8811
+ }
8812
+ return order2;
8813
+ }
8814
+ function moveItem([...arr], fromIndex, toIndex) {
8815
+ const startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex;
8816
+ if (startIndex >= 0 && startIndex < arr.length) {
8817
+ const endIndex = toIndex < 0 ? arr.length + toIndex : toIndex;
8818
+ const [item] = arr.splice(fromIndex, 1);
8819
+ arr.splice(endIndex, 0, item);
8820
+ }
8821
+ return arr;
8822
+ }
8823
+ function useDefaultMotionValue(value, defaultValue = 0) {
8824
+ return isMotionValue(value) ? value : motionValue(defaultValue);
8828
8825
  }
8829
- function getGroupId(props, parentGroup) {
8830
- const shouldInherit = props.inherit === true || props.inherit === "id";
8831
- const parentId = parentGroup == null ? void 0 : parentGroup.id;
8832
- if (shouldInherit && parentId) {
8833
- return props.id ? `${parentId}-${props.id}` : parentId;
8834
- }
8835
- return props.id;
8836
- }
8837
- function getGroup(props, parentGroup) {
8838
- const shouldInherit = props.inherit === true || props.inherit === "group";
8839
- return shouldInherit ? (parentGroup == null ? void 0 : parentGroup.group) || nodeGroup() : nodeGroup();
8840
- }
8841
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
8842
- __name: "LayoutGroup",
8826
+ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
8827
+ ...{
8828
+ name: "ReorderGroup",
8829
+ inheritAttrs: false
8830
+ },
8831
+ __name: "Group",
8843
8832
  props: {
8844
- id: {},
8845
- inherit: { type: [Boolean, String] }
8833
+ axis: { default: "y" },
8834
+ "onUpdate:values": {},
8835
+ values: {},
8836
+ as: { default: "ul" },
8837
+ asChild: { type: Boolean },
8838
+ whileDrag: {},
8839
+ custom: {},
8840
+ initial: { type: [String, Object, Boolean] },
8841
+ animate: {},
8842
+ exit: {},
8843
+ variants: {},
8844
+ style: {},
8845
+ transformTemplate: {},
8846
+ transition: {},
8847
+ layoutGroup: {},
8848
+ motionConfig: {},
8849
+ onAnimationComplete: {},
8850
+ onUpdate: {},
8851
+ layout: { type: [Boolean, String] },
8852
+ layoutId: {},
8853
+ layoutScroll: { type: Boolean },
8854
+ layoutRoot: { type: Boolean },
8855
+ "data-framer-portal-id": {},
8856
+ crossfade: { type: Boolean },
8857
+ onBeforeLayoutMeasure: {},
8858
+ onLayoutMeasure: {},
8859
+ onLayoutAnimationStart: {},
8860
+ onLayoutAnimationComplete: {},
8861
+ globalPressTarget: { type: Boolean },
8862
+ press: {},
8863
+ onPressStart: {},
8864
+ onPress: {},
8865
+ onPressCancel: {},
8866
+ hover: {},
8867
+ onHoverStart: {},
8868
+ onHoverEnd: {},
8869
+ inViewOptions: {},
8870
+ inView: {},
8871
+ onViewportEnter: {},
8872
+ onViewportLeave: {},
8873
+ drag: { type: [Boolean, String] },
8874
+ dragSnapToOrigin: { type: Boolean },
8875
+ dragDirectionLock: { type: Boolean },
8876
+ dragPropagation: { type: Boolean },
8877
+ dragConstraints: { type: [Boolean, Object] },
8878
+ dragElastic: { type: [Boolean, Number, Object] },
8879
+ dragMomentum: { type: Boolean },
8880
+ dragTransition: {},
8881
+ dragListener: { type: Boolean },
8882
+ dragControls: {},
8883
+ onDragStart: {},
8884
+ onDragEnd: {},
8885
+ onDrag: {},
8886
+ onDirectionLock: {},
8887
+ onDragTransitionEnd: {},
8888
+ onMeasureDragConstraints: {},
8889
+ onPanSessionStart: {},
8890
+ onPanStart: {},
8891
+ onPan: {},
8892
+ onPanEnd: {},
8893
+ focus: {},
8894
+ onFocus: {},
8895
+ onBlur: {}
8846
8896
  },
8847
8897
  setup(__props) {
8848
8898
  const props = __props;
8849
- const { forceRender, key } = useLayoutGroupProvider(props);
8899
+ const { axis } = vue.toRefs(props);
8900
+ const order2 = [];
8901
+ let isReordering = false;
8902
+ function warning2() {
8903
+ heyListen.invariant(Boolean(props.values), "Reorder.Group must be provided a values prop");
8904
+ }
8905
+ vue.onUpdated(() => {
8906
+ isReordering = false;
8907
+ });
8908
+ reorderContextProvider({
8909
+ axis,
8910
+ registerItem: (value, layout) => {
8911
+ const idx = order2.findIndex((entry) => value === entry.value);
8912
+ if (idx !== -1) {
8913
+ order2[idx].layout = layout[axis.value];
8914
+ } else {
8915
+ order2.push({ value, layout: layout[axis.value] });
8916
+ }
8917
+ order2.sort(compareMin);
8918
+ },
8919
+ updateOrder: (item, offset, velocity) => {
8920
+ if (isReordering)
8921
+ return;
8922
+ const newOrder = checkReorder(order2, item, offset, velocity);
8923
+ if (order2 !== newOrder) {
8924
+ isReordering = true;
8925
+ props["onUpdate:values"](
8926
+ newOrder.map(getValue).filter((value) => props.values.includes(value))
8927
+ );
8928
+ }
8929
+ }
8930
+ });
8931
+ const attrs = vue.useAttrs();
8932
+ function bindProps() {
8933
+ return {
8934
+ ...attrs,
8935
+ ...props
8936
+ };
8937
+ }
8850
8938
  return (_ctx, _cache) => {
8851
- return vue.renderSlot(_ctx.$slots, "default", {
8852
- renderKey: vue.unref(key),
8853
- forceRender: vue.unref(forceRender)
8854
- });
8939
+ return vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$5), vue.normalizeProps(vue.guardReactiveProps(bindProps())), {
8940
+ default: vue.withCtx(() => [
8941
+ vue.renderSlot(_ctx.$slots, "default"),
8942
+ vue.createTextVNode(" " + vue.toDisplayString(warning2()), 1)
8943
+ ]),
8944
+ _: 3
8945
+ }, 16);
8855
8946
  };
8856
8947
  }
8857
8948
  });
@@ -9055,12 +9146,221 @@ function useVelocity(value) {
9055
9146
  });
9056
9147
  return velocity;
9057
9148
  }
9149
+ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
9150
+ ...{
9151
+ name: "ReorderItem",
9152
+ inheritAttrs: false
9153
+ },
9154
+ __name: "Item",
9155
+ props: {
9156
+ value: {},
9157
+ layout: { type: [Boolean, String], default: true },
9158
+ as: { default: "li" },
9159
+ asChild: { type: Boolean },
9160
+ whileDrag: { default: void 0 },
9161
+ custom: {},
9162
+ initial: { type: [String, Object, Boolean], default: void 0 },
9163
+ animate: { default: void 0 },
9164
+ exit: {},
9165
+ variants: {},
9166
+ style: {},
9167
+ transformTemplate: {},
9168
+ transition: {},
9169
+ layoutGroup: {},
9170
+ motionConfig: {},
9171
+ onAnimationComplete: {},
9172
+ onUpdate: {},
9173
+ layoutId: { default: void 0 },
9174
+ layoutScroll: { type: Boolean, default: false },
9175
+ layoutRoot: { type: Boolean, default: false },
9176
+ "data-framer-portal-id": {},
9177
+ crossfade: { type: Boolean, default: true },
9178
+ onBeforeLayoutMeasure: {},
9179
+ onLayoutMeasure: {},
9180
+ onLayoutAnimationStart: {},
9181
+ onLayoutAnimationComplete: {},
9182
+ globalPressTarget: { type: Boolean },
9183
+ press: {},
9184
+ onPressStart: {},
9185
+ onPress: {},
9186
+ onPressCancel: {},
9187
+ hover: { default: void 0 },
9188
+ onHoverStart: {},
9189
+ onHoverEnd: {},
9190
+ inViewOptions: {},
9191
+ inView: { default: void 0 },
9192
+ onViewportEnter: {},
9193
+ onViewportLeave: {},
9194
+ drag: { type: [Boolean, String] },
9195
+ dragSnapToOrigin: { type: Boolean },
9196
+ dragDirectionLock: { type: Boolean },
9197
+ dragPropagation: { type: Boolean },
9198
+ dragConstraints: { type: [Boolean, Object] },
9199
+ dragElastic: { type: [Boolean, Number, Object], default: 0.5 },
9200
+ dragMomentum: { type: Boolean, default: true },
9201
+ dragTransition: {},
9202
+ dragListener: { type: Boolean, default: true },
9203
+ dragControls: {},
9204
+ onDragStart: {},
9205
+ onDragEnd: {},
9206
+ onDrag: {},
9207
+ onDirectionLock: {},
9208
+ onDragTransitionEnd: {},
9209
+ onMeasureDragConstraints: {},
9210
+ onPanSessionStart: {},
9211
+ onPanStart: {},
9212
+ onPan: {},
9213
+ onPanEnd: {},
9214
+ focus: {},
9215
+ onFocus: {},
9216
+ onBlur: {}
9217
+ },
9218
+ setup(__props) {
9219
+ var _a, _b;
9220
+ const props = __props;
9221
+ const { style: style2 } = vue.toRefs(props);
9222
+ const context = useReorderContext(null);
9223
+ const point2 = {
9224
+ x: useDefaultMotionValue((_a = style2.value) == null ? void 0 : _a.x),
9225
+ y: useDefaultMotionValue((_b = style2.value) == null ? void 0 : _b.y)
9226
+ };
9227
+ const zIndex = useTransform([point2.x, point2.y], ([latestX, latestY]) => latestX || latestY ? 1 : "unset");
9228
+ function warning2() {
9229
+ heyListen.invariant(Boolean(context), "Reorder.Item must be a child of Reorder.Group");
9230
+ }
9231
+ const { axis, registerItem, updateOrder } = context || {};
9232
+ const attrs = vue.useAttrs();
9233
+ function bindProps() {
9234
+ return {
9235
+ ...attrs,
9236
+ ...props,
9237
+ style: {
9238
+ ...style2.value,
9239
+ x: point2.x,
9240
+ y: point2.y,
9241
+ zIndex
9242
+ }
9243
+ };
9244
+ }
9245
+ const drag = vue.computed(() => {
9246
+ if (props.drag) {
9247
+ return props.drag;
9248
+ }
9249
+ return axis.value;
9250
+ });
9251
+ return (_ctx, _cache) => {
9252
+ return vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$5), vue.mergeProps(bindProps(), {
9253
+ drag: drag.value,
9254
+ "drag-snap-to-origin": true,
9255
+ onDrag: _cache[0] || (_cache[0] = (event, gesturePoint) => {
9256
+ const { velocity } = gesturePoint;
9257
+ velocity[vue.unref(axis)] && vue.unref(updateOrder)(_ctx.value, point2[vue.unref(axis)].get(), velocity[vue.unref(axis)]);
9258
+ _ctx.onDrag && _ctx.onDrag(event, gesturePoint);
9259
+ }),
9260
+ onLayoutMeasure: _cache[1] || (_cache[1] = (measured) => vue.unref(registerItem)(_ctx.value, measured))
9261
+ }), {
9262
+ default: vue.withCtx(() => [
9263
+ vue.renderSlot(_ctx.$slots, "default"),
9264
+ vue.createTextVNode(" " + vue.toDisplayString(warning2()), 1)
9265
+ ]),
9266
+ _: 3
9267
+ }, 16, ["drag"]);
9268
+ };
9269
+ }
9270
+ });
9271
+ const ReorderGroup = _sfc_main$2;
9272
+ const ReorderItem = _sfc_main$1;
9273
+ const Reorder = {
9274
+ Group: ReorderGroup,
9275
+ Item: ReorderItem
9276
+ };
9277
+ function useForceUpdate() {
9278
+ const key = vue.ref(0);
9279
+ function forceUpdate() {
9280
+ key.value++;
9281
+ }
9282
+ return [forceUpdate, key];
9283
+ }
9284
+ function notify(node) {
9285
+ return !node.isLayoutDirty && node.willUpdate(false);
9286
+ }
9287
+ function nodeGroup() {
9288
+ const nodes = /* @__PURE__ */ new Set();
9289
+ const subscriptions = /* @__PURE__ */ new WeakMap();
9290
+ const dirtyAll = () => nodes.forEach(notify);
9291
+ return {
9292
+ add: (node) => {
9293
+ nodes.add(node);
9294
+ subscriptions.set(
9295
+ node,
9296
+ node.addEventListener("willUpdate", dirtyAll)
9297
+ );
9298
+ },
9299
+ remove: (node) => {
9300
+ nodes.delete(node);
9301
+ const unsubscribe = subscriptions.get(node);
9302
+ if (unsubscribe) {
9303
+ unsubscribe();
9304
+ subscriptions.delete(node);
9305
+ }
9306
+ },
9307
+ dirty: dirtyAll
9308
+ };
9309
+ }
9310
+ function useLayoutGroupProvider(props) {
9311
+ const parentGroup = injectLayoutGroup(null);
9312
+ const [forceRender, key] = useForceUpdate();
9313
+ const context = {
9314
+ id: getGroupId(props, parentGroup),
9315
+ group: getGroup(props, parentGroup),
9316
+ forceRender,
9317
+ key
9318
+ };
9319
+ provideLayoutGroup(context);
9320
+ return context;
9321
+ }
9322
+ function useLayoutGroup() {
9323
+ const { forceRender } = injectLayoutGroup({ forceRender: () => {
9324
+ } });
9325
+ return { forceRender };
9326
+ }
9327
+ function getGroupId(props, parentGroup) {
9328
+ const shouldInherit = props.inherit === true || props.inherit === "id";
9329
+ const parentId = parentGroup == null ? void 0 : parentGroup.id;
9330
+ if (shouldInherit && parentId) {
9331
+ return props.id ? `${parentId}-${props.id}` : parentId;
9332
+ }
9333
+ return props.id;
9334
+ }
9335
+ function getGroup(props, parentGroup) {
9336
+ const shouldInherit = props.inherit === true || props.inherit === "group";
9337
+ return shouldInherit ? (parentGroup == null ? void 0 : parentGroup.group) || nodeGroup() : nodeGroup();
9338
+ }
9339
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
9340
+ __name: "LayoutGroup",
9341
+ props: {
9342
+ id: {},
9343
+ inherit: { type: [Boolean, String] }
9344
+ },
9345
+ setup(__props) {
9346
+ const props = __props;
9347
+ const { forceRender, key } = useLayoutGroupProvider(props);
9348
+ return (_ctx, _cache) => {
9349
+ return vue.renderSlot(_ctx.$slots, "default", {
9350
+ renderKey: vue.unref(key),
9351
+ forceRender: vue.unref(forceRender)
9352
+ });
9353
+ };
9354
+ }
9355
+ });
9058
9356
  const components = {
9059
9357
  motion: [
9060
9358
  "Motion",
9061
9359
  "AnimatePresence",
9062
9360
  "LayoutGroup",
9063
- "MotionConfig"
9361
+ "MotionConfig",
9362
+ "ReorderGroup",
9363
+ "ReorderItem"
9064
9364
  ]
9065
9365
  };
9066
9366
  const utilities = {
@@ -9237,11 +9537,14 @@ class DragControls {
9237
9537
  }
9238
9538
  const createDragControls = () => new DragControls();
9239
9539
  const useDragControls = createDragControls;
9240
- exports.AnimatePresence = _sfc_main$2;
9540
+ exports.AnimatePresence = _sfc_main$4;
9241
9541
  exports.LayoutGroup = _sfc_main;
9242
- exports.Motion = _sfc_main$3;
9243
- exports.MotionConfig = _sfc_main$1;
9542
+ exports.Motion = _sfc_main$5;
9543
+ exports.MotionConfig = _sfc_main$3;
9244
9544
  exports.MotionValue = MotionValue;
9545
+ exports.Reorder = Reorder;
9546
+ exports.ReorderGroup = ReorderGroup;
9547
+ exports.ReorderItem = ReorderItem;
9245
9548
  exports.animate = animate;
9246
9549
  exports.animateMini = animateMini;
9247
9550
  exports.anticipate = anticipate;
@@ -6,7 +6,6 @@ export interface NodeGroup {
6
6
  add: (node: IProjectionNode) => void;
7
7
  remove: (node: IProjectionNode) => void;
8
8
  dirty: VoidFunction;
9
- didUpdate: VoidFunction;
10
9
  }
11
10
  export interface LayoutGroupState {
12
11
  id?: string;
@@ -3,6 +3,5 @@ export interface NodeGroup {
3
3
  add: (node: IProjectionNode) => void;
4
4
  remove: (node: IProjectionNode) => void;
5
5
  dirty: VoidFunction;
6
- didUpdate: VoidFunction;
7
6
  }
8
7
  export declare function nodeGroup(): NodeGroup;
@@ -21,11 +21,7 @@ function nodeGroup() {
21
21
  subscriptions.delete(node);
22
22
  }
23
23
  },
24
- dirty: dirtyAll,
25
- didUpdate: () => {
26
- var _a;
27
- (_a = nodes[0]) == null ? void 0 : _a.didUpdate();
28
- }
24
+ dirty: dirtyAll
29
25
  };
30
26
  }
31
27
  export {
@@ -1,3 +1,4 @@
1
1
  export { Motion, motion, type MotionProps } from './motion';
2
2
  export * from './animate-presence';
3
3
  export * from './motion-config';
4
+ export * from './reorder';
@@ -35,6 +35,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
35
35
  layoutRoot: { type: Boolean },
36
36
  "data-framer-portal-id": {},
37
37
  crossfade: { type: Boolean },
38
+ onBeforeLayoutMeasure: { type: Function },
39
+ onLayoutMeasure: { type: Function },
40
+ onLayoutAnimationStart: { type: Function },
41
+ onLayoutAnimationComplete: { type: Function },
38
42
  globalPressTarget: { type: Boolean },
39
43
  press: {},
40
44
  onPressStart: { type: Function },