motion-v 1.3.0 → 1.3.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
@@ -5772,7 +5772,7 @@ const [injectMotion, provideMotion] = createContext("Motion");
5772
5772
  const [injectLayoutGroup, provideLayoutGroup] = createContext("LayoutGroup");
5773
5773
  const [useLazyMotionContext, lazyMotionContextProvider] = createContext("LazyMotionContext");
5774
5774
  const defaultConfig = {
5775
- reduceMotion: "never",
5775
+ reducedMotion: "never",
5776
5776
  transition: void 0,
5777
5777
  nonce: void 0
5778
5778
  };
@@ -5788,7 +5788,14 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
5788
5788
  __name: "MotionConfig",
5789
5789
  props: {
5790
5790
  transition: {},
5791
- reduceMotion: { default: defaultConfig.reduceMotion },
5791
+ reduceMotion: {},
5792
+ reducedMotion: { default: ({ reduceMotion }) => {
5793
+ if (core.isDef(reduceMotion)) {
5794
+ heyListen.warning(false, "`reduceMotion` is deprecated. Use `reducedMotion` instead.");
5795
+ return reduceMotion;
5796
+ }
5797
+ return defaultConfig.reducedMotion;
5798
+ } },
5792
5799
  nonce: {},
5793
5800
  inViewOptions: {}
5794
5801
  },
@@ -5797,7 +5804,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
5797
5804
  const parentConfig = useMotionConfig();
5798
5805
  const config = vue.computed(() => ({
5799
5806
  transition: props.transition ?? parentConfig.value.transition,
5800
- reduceMotion: props.reduceMotion ?? parentConfig.value.reduceMotion,
5807
+ reducedMotion: props.reducedMotion ?? parentConfig.value.reducedMotion,
5801
5808
  nonce: props.nonce ?? parentConfig.value.nonce,
5802
5809
  inViewOptions: props.inViewOptions ?? parentConfig.value.inViewOptions
5803
5810
  }));
@@ -5929,29 +5936,6 @@ const svgElementSet = new Set(svgElements);
5929
5936
  function isSVGElement(as) {
5930
5937
  return svgElementSet.has(as);
5931
5938
  }
5932
- function isAnimateChanged(oldOptions, newOptions) {
5933
- const oldAnimate = oldOptions.animate;
5934
- const newAnimate = newOptions.animate;
5935
- if (oldAnimate === newAnimate)
5936
- return false;
5937
- if (!oldAnimate || !newAnimate) {
5938
- return true;
5939
- }
5940
- if (typeof oldAnimate === "object" || typeof newAnimate === "object") {
5941
- const oldKeys = Object.keys(oldAnimate);
5942
- const newKeys = Object.keys(newAnimate);
5943
- if (oldKeys.length !== newKeys.length)
5944
- return true;
5945
- return oldKeys.some((key) => {
5946
- if (key === "transition")
5947
- return false;
5948
- const oldVal = oldAnimate[key];
5949
- const newVal = newAnimate[key];
5950
- return oldVal !== newVal;
5951
- });
5952
- }
5953
- return oldAnimate !== newAnimate;
5954
- }
5955
5939
  class Feature {
5956
5940
  constructor(state) {
5957
5941
  this.state = state;
@@ -7349,6 +7333,8 @@ class AnimationFeature extends Feature {
7349
7333
  isFallback,
7350
7334
  isExit
7351
7335
  } = {}) => {
7336
+ const { reducedMotion } = this.state.options.motionConfig;
7337
+ this.state.visualElement.shouldReduceMotion = reducedMotion === "always" || reducedMotion === "user" && !!prefersReducedMotion.current;
7352
7338
  const prevTarget = this.state.target;
7353
7339
  this.state.target = { ...this.state.baseTarget };
7354
7340
  let animationOptions = {};
@@ -7387,7 +7373,7 @@ class AnimationFeature extends Feature {
7387
7373
  ...this.state.baseTarget
7388
7374
  }
7389
7375
  },
7390
- reducedMotionConfig: this.state.options.motionConfig.reduceMotion
7376
+ reducedMotionConfig: this.state.options.motionConfig.reducedMotion
7391
7377
  });
7392
7378
  this.state.animateUpdates = this.animateUpdates;
7393
7379
  if (this.state.isMounted())
@@ -9111,8 +9097,7 @@ class MotionState {
9111
9097
  this.options = options;
9112
9098
  (_a = this.visualElement) == null ? void 0 : _a.update({
9113
9099
  ...this.options,
9114
- whileTap: this.options.whilePress,
9115
- reducedMotionConfig: this.options.motionConfig.reduceMotion
9100
+ whileTap: this.options.whilePress
9116
9101
  }, {
9117
9102
  isPresent: !doneCallbacks.has(this.element)
9118
9103
  });
@@ -9190,12 +9175,9 @@ class MotionState {
9190
9175
  }
9191
9176
  // Update motion state with new options
9192
9177
  update(options) {
9193
- const hasAnimateChange = isAnimateChanged(this.options, options);
9194
9178
  this.updateOptions(options);
9195
9179
  this.featureManager.update();
9196
- if (hasAnimateChange) {
9197
- this.startAnimation();
9198
- }
9180
+ this.startAnimation();
9199
9181
  }
9200
9182
  // Set animation state active status and propagate to children
9201
9183
  setActive(name, isActive, isAnimate = true) {
@@ -9775,7 +9757,6 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
9775
9757
  whileInView: {},
9776
9758
  whileFocus: {},
9777
9759
  forwardMotionProps: { type: Boolean },
9778
- features: {},
9779
9760
  ignoreStrict: { type: Boolean },
9780
9761
  custom: {},
9781
9762
  initial: { type: [String, Array, Object, Boolean] },
@@ -9786,8 +9767,6 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
9786
9767
  style: {},
9787
9768
  transformTemplate: {},
9788
9769
  transition: {},
9789
- layoutGroup: {},
9790
- motionConfig: {},
9791
9770
  onAnimationComplete: {},
9792
9771
  onUpdate: {},
9793
9772
  onAnimationStart: {},
@@ -10131,7 +10110,6 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
10131
10110
  whileInView: {},
10132
10111
  whileFocus: {},
10133
10112
  forwardMotionProps: { type: Boolean },
10134
- features: {},
10135
10113
  ignoreStrict: { type: Boolean },
10136
10114
  custom: {},
10137
10115
  initial: { type: [String, Array, Object, Boolean], default: void 0 },
@@ -10142,8 +10120,6 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
10142
10120
  style: {},
10143
10121
  transformTemplate: {},
10144
10122
  transition: {},
10145
- layoutGroup: {},
10146
- motionConfig: {},
10147
10123
  onAnimationComplete: {},
10148
10124
  onUpdate: {},
10149
10125
  onAnimationStart: {},