@nok-integration/storefront-react 0.20.6 → 0.20.7
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/index.mjs +17 -12
- package/dist/standalone/storefront.mjs +17 -12
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5703,6 +5703,17 @@ function useTopOffset(ref, property, enabled = true) {
|
|
|
5703
5703
|
}, [ref, property, enabled]);
|
|
5704
5704
|
}
|
|
5705
5705
|
const HOLD_MS = 1e3;
|
|
5706
|
+
const TRAVERSAL_WINDOW_MS = 1e3;
|
|
5707
|
+
const now = () => typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
5708
|
+
let lastTraversal = -Infinity;
|
|
5709
|
+
if (typeof window !== "undefined") {
|
|
5710
|
+
window.addEventListener("popstate", () => {
|
|
5711
|
+
lastTraversal = now();
|
|
5712
|
+
});
|
|
5713
|
+
}
|
|
5714
|
+
function followsTraversal() {
|
|
5715
|
+
return now() - lastTraversal < TRAVERSAL_WINDOW_MS;
|
|
5716
|
+
}
|
|
5706
5717
|
const RELEASES = ["touchstart", "wheel", "keydown", "pointerdown"];
|
|
5707
5718
|
function anchorTop(shouldHold = () => true) {
|
|
5708
5719
|
let released = false;
|
|
@@ -5730,14 +5741,6 @@ function anchorTop(shouldHold = () => true) {
|
|
|
5730
5741
|
});
|
|
5731
5742
|
return release;
|
|
5732
5743
|
}
|
|
5733
|
-
const TRAVERSAL_WINDOW_MS = 1e3;
|
|
5734
|
-
const now = () => typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
5735
|
-
let lastTraversal = -Infinity;
|
|
5736
|
-
if (typeof window !== "undefined") {
|
|
5737
|
-
window.addEventListener("popstate", () => {
|
|
5738
|
-
lastTraversal = now();
|
|
5739
|
-
});
|
|
5740
|
-
}
|
|
5741
5744
|
function documentTop(el) {
|
|
5742
5745
|
let top2 = 0;
|
|
5743
5746
|
for (let node = el; node; node = node.offsetParent) {
|
|
@@ -5752,7 +5755,7 @@ function useScreenAnchor(ref, enabled = true) {
|
|
|
5752
5755
|
useEffect(() => {
|
|
5753
5756
|
const el = ref.current;
|
|
5754
5757
|
if (!el || !enabled) return;
|
|
5755
|
-
if (
|
|
5758
|
+
if (followsTraversal()) return;
|
|
5756
5759
|
return anchorTop(() => beginsOnTheFirstViewport(el));
|
|
5757
5760
|
}, [ref, enabled]);
|
|
5758
5761
|
}
|
|
@@ -11284,9 +11287,11 @@ function useDocumentSnap(ref, enabled = true) {
|
|
|
11284
11287
|
root2.style.scrollSnapType = "y mandatory";
|
|
11285
11288
|
root2.style.scrollPaddingTop = "0px";
|
|
11286
11289
|
const top2 = () => window.scrollTo(0, 0);
|
|
11287
|
-
|
|
11288
|
-
|
|
11289
|
-
const
|
|
11290
|
+
const entered = !followsTraversal();
|
|
11291
|
+
if (entered) top2();
|
|
11292
|
+
const frame2 = entered && typeof window.requestAnimationFrame === "function" ? window.requestAnimationFrame(top2) : null;
|
|
11293
|
+
const release = entered ? anchorTop() : () => {
|
|
11294
|
+
};
|
|
11290
11295
|
const history = window.history;
|
|
11291
11296
|
const previousRestoration = history && "scrollRestoration" in history ? history.scrollRestoration : null;
|
|
11292
11297
|
if (previousRestoration !== null) history.scrollRestoration = "manual";
|
|
@@ -5703,6 +5703,17 @@ function useTopOffset(ref, property, enabled = true) {
|
|
|
5703
5703
|
}, [ref, property, enabled]);
|
|
5704
5704
|
}
|
|
5705
5705
|
const HOLD_MS = 1e3;
|
|
5706
|
+
const TRAVERSAL_WINDOW_MS = 1e3;
|
|
5707
|
+
const now = () => typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
5708
|
+
let lastTraversal = -Infinity;
|
|
5709
|
+
if (typeof window !== "undefined") {
|
|
5710
|
+
window.addEventListener("popstate", () => {
|
|
5711
|
+
lastTraversal = now();
|
|
5712
|
+
});
|
|
5713
|
+
}
|
|
5714
|
+
function followsTraversal() {
|
|
5715
|
+
return now() - lastTraversal < TRAVERSAL_WINDOW_MS;
|
|
5716
|
+
}
|
|
5706
5717
|
const RELEASES = ["touchstart", "wheel", "keydown", "pointerdown"];
|
|
5707
5718
|
function anchorTop(shouldHold = () => true) {
|
|
5708
5719
|
let released = false;
|
|
@@ -5730,14 +5741,6 @@ function anchorTop(shouldHold = () => true) {
|
|
|
5730
5741
|
});
|
|
5731
5742
|
return release;
|
|
5732
5743
|
}
|
|
5733
|
-
const TRAVERSAL_WINDOW_MS = 1e3;
|
|
5734
|
-
const now = () => typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
5735
|
-
let lastTraversal = -Infinity;
|
|
5736
|
-
if (typeof window !== "undefined") {
|
|
5737
|
-
window.addEventListener("popstate", () => {
|
|
5738
|
-
lastTraversal = now();
|
|
5739
|
-
});
|
|
5740
|
-
}
|
|
5741
5744
|
function documentTop(el) {
|
|
5742
5745
|
let top2 = 0;
|
|
5743
5746
|
for (let node = el; node; node = node.offsetParent) {
|
|
@@ -5752,7 +5755,7 @@ function useScreenAnchor(ref, enabled = true) {
|
|
|
5752
5755
|
useEffect(() => {
|
|
5753
5756
|
const el = ref.current;
|
|
5754
5757
|
if (!el || !enabled) return;
|
|
5755
|
-
if (
|
|
5758
|
+
if (followsTraversal()) return;
|
|
5756
5759
|
return anchorTop(() => beginsOnTheFirstViewport(el));
|
|
5757
5760
|
}, [ref, enabled]);
|
|
5758
5761
|
}
|
|
@@ -11284,9 +11287,11 @@ function useDocumentSnap(ref, enabled = true) {
|
|
|
11284
11287
|
root2.style.scrollSnapType = "y mandatory";
|
|
11285
11288
|
root2.style.scrollPaddingTop = "0px";
|
|
11286
11289
|
const top2 = () => window.scrollTo(0, 0);
|
|
11287
|
-
|
|
11288
|
-
|
|
11289
|
-
const
|
|
11290
|
+
const entered = !followsTraversal();
|
|
11291
|
+
if (entered) top2();
|
|
11292
|
+
const frame2 = entered && typeof window.requestAnimationFrame === "function" ? window.requestAnimationFrame(top2) : null;
|
|
11293
|
+
const release = entered ? anchorTop() : () => {
|
|
11294
|
+
};
|
|
11290
11295
|
const history = window.history;
|
|
11291
11296
|
const previousRestoration = history && "scrollRestoration" in history ? history.scrollRestoration : null;
|
|
11292
11297
|
if (previousRestoration !== null) history.scrollRestoration = "manual";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nok-integration/storefront-react",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.7",
|
|
4
4
|
"description": "Mountable React storefront components: catalogue, product detail and cart, mounted directly into a host DOM tree. No iframe.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|