@alpinejs/intersect
Advanced tools
Comparing version 3.13.0 to 3.13.1
@@ -8,3 +8,3 @@ (() => { | ||
rootMargin: getRootMargin(modifiers), | ||
threshold: getThreshhold(modifiers) | ||
threshold: getThreshold(modifiers) | ||
}; | ||
@@ -25,3 +25,3 @@ let observer = new IntersectionObserver((entries) => { | ||
} | ||
function getThreshhold(modifiers) { | ||
function getThreshold(modifiers) { | ||
if (modifiers.includes("full")) | ||
@@ -28,0 +28,0 @@ return 0.99; |
@@ -1,1 +0,1 @@ | ||
(()=>{function o(e){e.directive("intersect",(t,{value:i,expression:l,modifiers:n},{evaluateLater:r,cleanup:c})=>{let s=r(l),h={rootMargin:x(n),threshold:f(n)},u=new IntersectionObserver(a=>{a.forEach(d=>{d.isIntersecting!==(i==="leave")&&(s(),n.includes("once")&&u.disconnect())})},h);u.observe(t),c(()=>{u.disconnect()})})}function f(e){if(e.includes("full"))return .99;if(e.includes("half"))return .5;if(!e.includes("threshold"))return 0;let t=e[e.indexOf("threshold")+1];return t==="100"?1:t==="0"?0:Number(`.${t}`)}function p(e){let t=e.match(/^(-?[0-9]+)(px|%)?$/);return t?t[1]+(t[2]||"px"):void 0}function x(e){let t="margin",i="0px 0px 0px 0px",l=e.indexOf(t);if(l===-1)return i;let n=[];for(let r=1;r<5;r++)n.push(p(e[l+r]||""));return n=n.filter(r=>r!==void 0),n.length?n.join(" ").trim():i}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(o)});})(); | ||
(()=>{function o(e){e.directive("intersect",(t,{value:i,expression:l,modifiers:n},{evaluateLater:r,cleanup:c})=>{let s=r(l),a={rootMargin:x(n),threshold:f(n)},u=new IntersectionObserver(d=>{d.forEach(h=>{h.isIntersecting!==(i==="leave")&&(s(),n.includes("once")&&u.disconnect())})},a);u.observe(t),c(()=>{u.disconnect()})})}function f(e){if(e.includes("full"))return .99;if(e.includes("half"))return .5;if(!e.includes("threshold"))return 0;let t=e[e.indexOf("threshold")+1];return t==="100"?1:t==="0"?0:Number(`.${t}`)}function p(e){let t=e.match(/^(-?[0-9]+)(px|%)?$/);return t?t[1]+(t[2]||"px"):void 0}function x(e){let t="margin",i="0px 0px 0px 0px",l=e.indexOf(t);if(l===-1)return i;let n=[];for(let r=1;r<5;r++)n.push(p(e[l+r]||""));return n=n.filter(r=>r!==void 0),n.length?n.join(" ").trim():i}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(o)});})(); |
@@ -32,3 +32,3 @@ var __defProp = Object.defineProperty; | ||
rootMargin: getRootMargin(modifiers), | ||
threshold: getThreshhold(modifiers) | ||
threshold: getThreshold(modifiers) | ||
}; | ||
@@ -49,3 +49,3 @@ let observer = new IntersectionObserver((entries) => { | ||
} | ||
function getThreshhold(modifiers) { | ||
function getThreshold(modifiers) { | ||
if (modifiers.includes("full")) | ||
@@ -52,0 +52,0 @@ return 0.99; |
@@ -7,3 +7,3 @@ // packages/intersect/src/index.js | ||
rootMargin: getRootMargin(modifiers), | ||
threshold: getThreshhold(modifiers) | ||
threshold: getThreshold(modifiers) | ||
}; | ||
@@ -24,3 +24,3 @@ let observer = new IntersectionObserver((entries) => { | ||
} | ||
function getThreshhold(modifiers) { | ||
function getThreshold(modifiers) { | ||
if (modifiers.includes("full")) | ||
@@ -27,0 +27,0 @@ return 0.99; |
{ | ||
"name": "@alpinejs/intersect", | ||
"version": "3.13.0", | ||
"version": "3.13.1", | ||
"description": "Trigger JavaScript when an element enters the viewport", | ||
@@ -5,0 +5,0 @@ "homepage": "https://alpinejs.dev/plugins/intersect", |
@@ -7,3 +7,3 @@ export default function (Alpine) { | ||
rootMargin: getRootMargin(modifiers), | ||
threshold: getThreshhold(modifiers), | ||
threshold: getThreshold(modifiers), | ||
} | ||
@@ -30,3 +30,3 @@ | ||
function getThreshhold(modifiers) { | ||
function getThreshold(modifiers) { | ||
if (modifiers.includes('full')) return 0.99 | ||
@@ -33,0 +33,0 @@ if (modifiers.includes('half')) return 0.5 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10026