coonlink-luxy 26.1.4 → 26.1.6

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;AA8ND,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;AAyOD,wBAAgB,kBAAkB,IAAI,oBAAoB,CAEzD;AAED,wBAAgB,uBAAuB,IAAI,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAEjF"}
package/dist/index.js CHANGED
@@ -46,12 +46,27 @@ class Engine {
46
46
  this.resizeObserver = null;
47
47
  this.pauseForOverlay = false;
48
48
  this.overlayObserver = null;
49
- this.onScrollResume = () => { this.ensureTicking(); };
49
+ this.onScrollResume = () => {
50
+ if (Math.abs(getScrollTop() - this.wrapperOffset) > 0.5)
51
+ this.ensureTicking();
52
+ };
50
53
  this.onResize = () => {
51
54
  if (!this.wrapper)
52
55
  return;
53
56
  const h = Math.max(this.wrapper.scrollHeight, this.wrapper.clientHeight);
54
57
  document.body.style.height = `${h}px`;
58
+ if (this.scrollRaf === 0) {
59
+ const newST = getScrollTop();
60
+ const diff = Math.abs(newST - this.wrapperOffset);
61
+ if (diff > 0 && diff < 5) {
62
+ const maxOff = Math.max(0, h - window.innerHeight);
63
+ this.wrapperOffset = Math.max(0, Math.min(Math.round(newST), maxOff));
64
+ this.scrollTop = newST;
65
+ const y = Math.round(-this.wrapperOffset * 100) / 100;
66
+ this.wrapper.style.transform = `translate3d(0, ${y}px, 0)`;
67
+ return;
68
+ }
69
+ }
55
70
  this.ensureTicking();
56
71
  };
57
72
  }
@@ -96,7 +111,7 @@ class Engine {
96
111
  for (let i = 0; i < this.targets.length; i++)
97
112
  this.targetsUpdate(this.targets[i]);
98
113
  if (this.isSettled()) {
99
- this.wrapperOffset = this.scrollTop;
114
+ this.wrapperOffset = Math.round(this.scrollTop);
100
115
  this.wrapperUpdate();
101
116
  this.scrollRaf = 0;
102
117
  window.addEventListener('scroll', this.onScrollResume, { passive: true });
@@ -127,11 +142,7 @@ class Engine {
127
142
  if (!this.settings.respectOpenModalOverlay)
128
143
  return;
129
144
  this.pauseForOverlay = hasOpenModalOverlay();
130
- this.overlayObserver = new MutationObserver(() => {
131
- this.syncOverlayPause();
132
- if (!this.pauseForOverlay)
133
- this.ensureTicking();
134
- });
145
+ this.overlayObserver = new MutationObserver(() => this.syncOverlayPause());
135
146
  this.overlayObserver.observe(document.body, {
136
147
  childList: true, subtree: true, attributes: true, attributeFilter: ['data-state'],
137
148
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coonlink-luxy",
3
- "version": "26.1.4",
3
+ "version": "26.1.6",
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": [