@brandocms/jupiter 5.0.0-beta.14 → 5.0.0-beta.15
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/package.json +1 -1
- package/src/modules/Looper/index.js +26 -21
package/package.json
CHANGED
|
@@ -67,6 +67,10 @@ const DEFAULT_OPTIONS = {
|
|
|
67
67
|
mouseOut: { speed: 1, duration: 0.75 },
|
|
68
68
|
},
|
|
69
69
|
|
|
70
|
+
// Called when the looper is ready to reveal. Receives (wrapper, loop) args.
|
|
71
|
+
// Override to control the reveal animation yourself. Default fades in the wrapper.
|
|
72
|
+
onReveal: null,
|
|
73
|
+
|
|
70
74
|
selector: '[data-moonwalk-run="loop"]',
|
|
71
75
|
}
|
|
72
76
|
|
|
@@ -928,13 +932,11 @@ function horizontalLoop(app, items, config) {
|
|
|
928
932
|
e.preventDefault()
|
|
929
933
|
}
|
|
930
934
|
|
|
931
|
-
//
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
container.addEventListener('pointerup', onPointerUp)
|
|
937
|
-
container.addEventListener('pointercancel', onPointerUp)
|
|
935
|
+
// Add move/up listeners to window so events are never lost
|
|
936
|
+
// (pointer capture can silently fail or be released mid-drag)
|
|
937
|
+
window.addEventListener('pointermove', onPointerMove, { passive: false })
|
|
938
|
+
window.addEventListener('pointerup', onPointerUp)
|
|
939
|
+
window.addEventListener('pointercancel', onPointerUp)
|
|
938
940
|
}
|
|
939
941
|
|
|
940
942
|
/**
|
|
@@ -962,10 +964,9 @@ function horizontalLoop(app, items, config) {
|
|
|
962
964
|
// Bias toward carousel interaction: vertical must be 1.2x horizontal to abort.
|
|
963
965
|
if (deltaY > deltaX * 1.2) {
|
|
964
966
|
isDragging = false
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
container.removeEventListener('pointercancel', onPointerUp)
|
|
967
|
+
window.removeEventListener('pointermove', onPointerMove)
|
|
968
|
+
window.removeEventListener('pointerup', onPointerUp)
|
|
969
|
+
window.removeEventListener('pointercancel', onPointerUp)
|
|
969
970
|
// Resume crawl if we stopped it on pointerdown
|
|
970
971
|
if (stoppedAnimation && config.crawl) {
|
|
971
972
|
resumeCrawl()
|
|
@@ -1014,13 +1015,10 @@ function horizontalLoop(app, items, config) {
|
|
|
1014
1015
|
|
|
1015
1016
|
isDragging = false
|
|
1016
1017
|
|
|
1017
|
-
// Release pointer capture
|
|
1018
|
-
try { container.releasePointerCapture(e.pointerId) } catch (err) { /* ignore */ }
|
|
1019
|
-
|
|
1020
1018
|
// Clean up listeners
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1019
|
+
window.removeEventListener('pointermove', onPointerMove)
|
|
1020
|
+
window.removeEventListener('pointerup', onPointerUp)
|
|
1021
|
+
window.removeEventListener('pointercancel', onPointerUp)
|
|
1024
1022
|
|
|
1025
1023
|
// Reset cursor and re-enable hover effects (only if we actually dragged)
|
|
1026
1024
|
if (hasDragged) {
|
|
@@ -1364,9 +1362,9 @@ function horizontalLoop(app, items, config) {
|
|
|
1364
1362
|
cleanup: () => {
|
|
1365
1363
|
container.removeEventListener('pointerdown', onPointerDown)
|
|
1366
1364
|
container.removeEventListener('click', swallowClick, { capture: true })
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1365
|
+
window.removeEventListener('pointermove', onPointerMove)
|
|
1366
|
+
window.removeEventListener('pointerup', onPointerUp)
|
|
1367
|
+
window.removeEventListener('pointercancel', onPointerUp)
|
|
1370
1368
|
},
|
|
1371
1369
|
}
|
|
1372
1370
|
}
|
|
@@ -1937,7 +1935,14 @@ export default class Looper {
|
|
|
1937
1935
|
|
|
1938
1936
|
// Reveal lazyload images: immediately reveal off-screen items (no visible transition),
|
|
1939
1937
|
// defer reveal of viewport items until after wrapper fade-in for a nice per-image fade
|
|
1940
|
-
if (this.
|
|
1938
|
+
if (this.opts.onReveal) {
|
|
1939
|
+
// Custom reveal callback — caller handles animation and lazyload
|
|
1940
|
+
if (this.app?.lazyload && wrapper) {
|
|
1941
|
+
const pictures = Dom.all(wrapper, '[data-ll-srcset]')
|
|
1942
|
+
pictures.forEach(picture => this.app.lazyload.revealPicture(picture))
|
|
1943
|
+
}
|
|
1944
|
+
this.opts.onReveal(wrapper, loop)
|
|
1945
|
+
} else if (this.app?.lazyload && wrapper) {
|
|
1941
1946
|
const wrapperRect = wrapper.getBoundingClientRect()
|
|
1942
1947
|
const pictures = Dom.all(wrapper, '[data-ll-srcset]')
|
|
1943
1948
|
const viewportPictures = []
|