coonlink-luxy 26.1.7 → 26.1.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC;IAC7C,OAAO,IAAI,IAAI,CAAC;CACjB;AAqLD,wBAAgB,kBAAkB,IAAI,oBAAoB,CAEzD;AAED,wBAAgB,uBAAuB,IAAI,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAEjF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC;IAC7C,OAAO,IAAI,IAAI,CAAC;CACjB;AA6LD,wBAAgB,kBAAkB,IAAI,oBAAoB,CAEzD;AAED,wBAAgB,uBAAuB,IAAI,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAEjF"}
package/dist/index.js CHANGED
@@ -91,7 +91,7 @@ class Engine {
91
91
  document.body.style.height = `${h}px`;
92
92
  }
93
93
  if (!this.pauseForOverlay) {
94
- this.scrollTop = getScrollTop();
94
+ this.scrollTop = Math.round(getScrollTop());
95
95
  this.wrapperUpdate(h);
96
96
  for (let i = 0; i < this.targets.length; i++)
97
97
  this.targetsUpdate(this.targets[i]);
@@ -103,9 +103,17 @@ class Engine {
103
103
  wrapperUpdate(contentHeight) {
104
104
  if (!this.wrapper)
105
105
  return;
106
- this.wrapperOffset += (this.scrollTop - this.wrapperOffset) * this.settings.wrapperSpeed;
107
106
  const maxOffset = Math.max(0, contentHeight - window.innerHeight);
108
- this.wrapperOffset = Math.max(0, Math.min(this.wrapperOffset, maxOffset));
107
+ const target = Math.max(0, Math.min(this.scrollTop, maxOffset));
108
+ const delta = target - this.wrapperOffset;
109
+ if (Math.abs(delta) < 0.1) {
110
+ if (this.wrapperOffset !== target) {
111
+ this.wrapperOffset = target;
112
+ this.wrapper.style.transform = `translate3d(0, ${-Math.round(this.wrapperOffset)}px, 0)`;
113
+ }
114
+ return;
115
+ }
116
+ this.wrapperOffset += delta * this.settings.wrapperSpeed;
109
117
  const y = Math.round(-this.wrapperOffset * 100) / 100;
110
118
  this.wrapper.style.transform = `translate3d(0, ${y}px, 0)`;
111
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coonlink-luxy",
3
- "version": "26.1.7",
3
+ "version": "26.1.8",
4
4
  "description": "Inertia scroll and parallax (luxy-style) with fixes for modern browsers, React/Next, and prefers-reduced-motion.",
5
5
  "homepage": "https://dev.coonlink.com",
6
6
  "keywords": [