motion-dom 12.33.2 → 12.34.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
@@ -5310,26 +5310,6 @@ const createBox = () => ({
5310
5310
  y: createAxis(),
5311
5311
  });
5312
5312
 
5313
- // Does this device prefer reduced motion? Returns `null` server-side.
5314
- const prefersReducedMotion = { current: null };
5315
- const hasReducedMotionListener = { current: false };
5316
-
5317
- const isBrowser = typeof window !== "undefined";
5318
- function initPrefersReducedMotion() {
5319
- hasReducedMotionListener.current = true;
5320
- if (!isBrowser)
5321
- return;
5322
- if (window.matchMedia) {
5323
- const motionMediaQuery = window.matchMedia("(prefers-reduced-motion)");
5324
- const setReducedMotionPreferences = () => (prefersReducedMotion.current = motionMediaQuery.matches);
5325
- motionMediaQuery.addEventListener("change", setReducedMotionPreferences);
5326
- setReducedMotionPreferences();
5327
- }
5328
- else {
5329
- prefersReducedMotion.current = false;
5330
- }
5331
- }
5332
-
5333
5313
  const visualElementStore = new WeakMap();
5334
5314
 
5335
5315
  function isAnimationControls(v) {
@@ -5415,6 +5395,26 @@ function updateMotionValuesFromProps(element, next, prev) {
5415
5395
  return next;
5416
5396
  }
5417
5397
 
5398
+ // Does this device prefer reduced motion? Returns `null` server-side.
5399
+ const prefersReducedMotion = { current: null };
5400
+ const hasReducedMotionListener = { current: false };
5401
+
5402
+ const isBrowser = typeof window !== "undefined";
5403
+ function initPrefersReducedMotion() {
5404
+ hasReducedMotionListener.current = true;
5405
+ if (!isBrowser)
5406
+ return;
5407
+ if (window.matchMedia) {
5408
+ const motionMediaQuery = window.matchMedia("(prefers-reduced-motion)");
5409
+ const setReducedMotionPreferences = () => (prefersReducedMotion.current = motionMediaQuery.matches);
5410
+ motionMediaQuery.addEventListener("change", setReducedMotionPreferences);
5411
+ setReducedMotionPreferences();
5412
+ }
5413
+ else {
5414
+ prefersReducedMotion.current = false;
5415
+ }
5416
+ }
5417
+
5418
5418
  const propEventHandlers = [
5419
5419
  "AnimationStart",
5420
5420
  "AnimationComplete",
@@ -5655,6 +5655,25 @@ class VisualElement {
5655
5655
  if (this.valueSubscriptions.has(key)) {
5656
5656
  this.valueSubscriptions.get(key)();
5657
5657
  }
5658
+ if (value.accelerate &&
5659
+ acceleratedValues.has(key) &&
5660
+ this.current instanceof HTMLElement) {
5661
+ const { factory, keyframes, times, ease, duration } = value.accelerate;
5662
+ const animation = new NativeAnimation({
5663
+ element: this.current,
5664
+ name: key,
5665
+ keyframes,
5666
+ times,
5667
+ ease,
5668
+ duration: motionUtils.secondsToMilliseconds(duration),
5669
+ });
5670
+ const cleanup = factory(animation);
5671
+ this.valueSubscriptions.set(key, () => {
5672
+ cleanup();
5673
+ animation.cancel();
5674
+ });
5675
+ return;
5676
+ }
5658
5677
  const valueIsTransform = transformProps.has(key);
5659
5678
  if (valueIsTransform && this.onBindTransform) {
5660
5679
  this.onBindTransform();
@@ -5668,7 +5687,8 @@ class VisualElement {
5668
5687
  this.scheduleRender();
5669
5688
  });
5670
5689
  let removeSyncCheck;
5671
- if (typeof window !== "undefined" && window.MotionCheckAppearSync) {
5690
+ if (typeof window !== "undefined" &&
5691
+ window.MotionCheckAppearSync) {
5672
5692
  removeSyncCheck = window.MotionCheckAppearSync(this, key, value);
5673
5693
  }
5674
5694
  this.valueSubscriptions.set(key, () => {