@alpinejs/intersect
Advanced tools
Comparing version 3.12.3 to 3.13.0
(() => { | ||
// packages/intersect/src/index.js | ||
function src_default(Alpine) { | ||
Alpine.directive("intersect", (el, {value, expression, modifiers}, {evaluateLater, cleanup}) => { | ||
Alpine.directive("intersect", (el, { value, expression, modifiers }, { evaluateLater, cleanup }) => { | ||
let evaluate = evaluateLater(expression); | ||
@@ -6,0 +6,0 @@ let options = { |
@@ -1,1 +0,1 @@ | ||
(()=>{function c(e){e.directive("intersect",(t,{value:i,expression:l,modifiers:n},{evaluateLater:r,cleanup:o})=>{let s=r(l),d={rootMargin:p(n),threshold:f(n)},u=new IntersectionObserver(h=>{h.forEach(a=>{a.isIntersecting!==(i==="leave")&&(s(),n.includes("once")&&u.disconnect())})},d);u.observe(t),o(()=>{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 x(e){let t=e.match(/^(-?[0-9]+)(px|%)?$/);return t?t[1]+(t[2]||"px"):void 0}function p(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(x(e[l+r]||""));return n=n.filter(r=>r!==void 0),n.length?n.join(" ").trim():i}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(c)});})(); | ||
(()=>{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)});})(); |
var __defProp = Object.defineProperty; | ||
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true}); | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, {get: all[name], enumerable: true}); | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// packages/intersect/builds/module.js | ||
__markAsModule(exports); | ||
__export(exports, { | ||
var module_exports = {}; | ||
__export(module_exports, { | ||
default: () => module_default | ||
}); | ||
module.exports = __toCommonJS(module_exports); | ||
// packages/intersect/src/index.js | ||
function src_default(Alpine) { | ||
Alpine.directive("intersect", (el, {value, expression, modifiers}, {evaluateLater, cleanup}) => { | ||
Alpine.directive("intersect", (el, { value, expression, modifiers }, { evaluateLater, cleanup }) => { | ||
let evaluate = evaluateLater(expression); | ||
@@ -70,1 +82,3 @@ let options = { | ||
var module_default = src_default; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = {}); |
// packages/intersect/src/index.js | ||
function src_default(Alpine) { | ||
Alpine.directive("intersect", (el, {value, expression, modifiers}, {evaluateLater, cleanup}) => { | ||
Alpine.directive("intersect", (el, { value, expression, modifiers }, { evaluateLater, cleanup }) => { | ||
let evaluate = evaluateLater(expression); | ||
@@ -5,0 +5,0 @@ let options = { |
{ | ||
"name": "@alpinejs/intersect", | ||
"version": "3.12.3", | ||
"version": "3.13.0", | ||
"description": "Trigger JavaScript when an element enters the viewport", | ||
@@ -5,0 +5,0 @@ "homepage": "https://alpinejs.dev/plugins/intersect", |
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
10034
257