Add supporting themes required for Lotusdocs
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import intersect from '../src/index.js'
|
||||
|
||||
document.addEventListener('alpine:init', () => {
|
||||
window.Alpine.plugin(intersect)
|
||||
})
|
||||
@@ -0,0 +1,5 @@
|
||||
import intersect from './../src/index.js'
|
||||
|
||||
export default intersect
|
||||
|
||||
export { intersect }
|
||||
60
themes/hugo-mod-jslibs-dist/alpinejs/packages/intersect/dist/cdn.js
vendored
Normal file
60
themes/hugo-mod-jslibs-dist/alpinejs/packages/intersect/dist/cdn.js
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
(() => {
|
||||
// packages/intersect/src/index.js
|
||||
function src_default(Alpine) {
|
||||
Alpine.directive("intersect", Alpine.skipDuringClone((el, { value, expression, modifiers }, { evaluateLater, cleanup }) => {
|
||||
let evaluate = evaluateLater(expression);
|
||||
let options = {
|
||||
rootMargin: getRootMargin(modifiers),
|
||||
threshold: getThreshold(modifiers)
|
||||
};
|
||||
let observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.isIntersecting === (value === "leave"))
|
||||
return;
|
||||
evaluate();
|
||||
modifiers.includes("once") && observer.disconnect();
|
||||
});
|
||||
}, options);
|
||||
observer.observe(el);
|
||||
cleanup(() => {
|
||||
observer.disconnect();
|
||||
});
|
||||
}));
|
||||
}
|
||||
function getThreshold(modifiers) {
|
||||
if (modifiers.includes("full"))
|
||||
return 0.99;
|
||||
if (modifiers.includes("half"))
|
||||
return 0.5;
|
||||
if (!modifiers.includes("threshold"))
|
||||
return 0;
|
||||
let threshold = modifiers[modifiers.indexOf("threshold") + 1];
|
||||
if (threshold === "100")
|
||||
return 1;
|
||||
if (threshold === "0")
|
||||
return 0;
|
||||
return Number(`.${threshold}`);
|
||||
}
|
||||
function getLengthValue(rawValue) {
|
||||
let match = rawValue.match(/^(-?[0-9]+)(px|%)?$/);
|
||||
return match ? match[1] + (match[2] || "px") : void 0;
|
||||
}
|
||||
function getRootMargin(modifiers) {
|
||||
const key = "margin";
|
||||
const fallback = "0px 0px 0px 0px";
|
||||
const index = modifiers.indexOf(key);
|
||||
if (index === -1)
|
||||
return fallback;
|
||||
let values = [];
|
||||
for (let i = 1; i < 5; i++) {
|
||||
values.push(getLengthValue(modifiers[index + i] || ""));
|
||||
}
|
||||
values = values.filter((v) => v !== void 0);
|
||||
return values.length ? values.join(" ").trim() : fallback;
|
||||
}
|
||||
|
||||
// packages/intersect/builds/cdn.js
|
||||
document.addEventListener("alpine:init", () => {
|
||||
window.Alpine.plugin(src_default);
|
||||
});
|
||||
})();
|
||||
1
themes/hugo-mod-jslibs-dist/alpinejs/packages/intersect/dist/cdn.min.js
vendored
Normal file
1
themes/hugo-mod-jslibs-dist/alpinejs/packages/intersect/dist/cdn.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(()=>{function o(e){e.directive("intersect",e.skipDuringClone((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)});})();
|
||||
86
themes/hugo-mod-jslibs-dist/alpinejs/packages/intersect/dist/module.cjs.js
vendored
Normal file
86
themes/hugo-mod-jslibs-dist/alpinejs/packages/intersect/dist/module.cjs.js
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
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 });
|
||||
};
|
||||
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
|
||||
var module_exports = {};
|
||||
__export(module_exports, {
|
||||
default: () => module_default,
|
||||
intersect: () => src_default
|
||||
});
|
||||
module.exports = __toCommonJS(module_exports);
|
||||
|
||||
// packages/intersect/src/index.js
|
||||
function src_default(Alpine) {
|
||||
Alpine.directive("intersect", Alpine.skipDuringClone((el, { value, expression, modifiers }, { evaluateLater, cleanup }) => {
|
||||
let evaluate = evaluateLater(expression);
|
||||
let options = {
|
||||
rootMargin: getRootMargin(modifiers),
|
||||
threshold: getThreshold(modifiers)
|
||||
};
|
||||
let observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.isIntersecting === (value === "leave"))
|
||||
return;
|
||||
evaluate();
|
||||
modifiers.includes("once") && observer.disconnect();
|
||||
});
|
||||
}, options);
|
||||
observer.observe(el);
|
||||
cleanup(() => {
|
||||
observer.disconnect();
|
||||
});
|
||||
}));
|
||||
}
|
||||
function getThreshold(modifiers) {
|
||||
if (modifiers.includes("full"))
|
||||
return 0.99;
|
||||
if (modifiers.includes("half"))
|
||||
return 0.5;
|
||||
if (!modifiers.includes("threshold"))
|
||||
return 0;
|
||||
let threshold = modifiers[modifiers.indexOf("threshold") + 1];
|
||||
if (threshold === "100")
|
||||
return 1;
|
||||
if (threshold === "0")
|
||||
return 0;
|
||||
return Number(`.${threshold}`);
|
||||
}
|
||||
function getLengthValue(rawValue) {
|
||||
let match = rawValue.match(/^(-?[0-9]+)(px|%)?$/);
|
||||
return match ? match[1] + (match[2] || "px") : void 0;
|
||||
}
|
||||
function getRootMargin(modifiers) {
|
||||
const key = "margin";
|
||||
const fallback = "0px 0px 0px 0px";
|
||||
const index = modifiers.indexOf(key);
|
||||
if (index === -1)
|
||||
return fallback;
|
||||
let values = [];
|
||||
for (let i = 1; i < 5; i++) {
|
||||
values.push(getLengthValue(modifiers[index + i] || ""));
|
||||
}
|
||||
values = values.filter((v) => v !== void 0);
|
||||
return values.length ? values.join(" ").trim() : fallback;
|
||||
}
|
||||
|
||||
// packages/intersect/builds/module.js
|
||||
var module_default = src_default;
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
intersect
|
||||
});
|
||||
60
themes/hugo-mod-jslibs-dist/alpinejs/packages/intersect/dist/module.esm.js
vendored
Normal file
60
themes/hugo-mod-jslibs-dist/alpinejs/packages/intersect/dist/module.esm.js
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
// packages/intersect/src/index.js
|
||||
function src_default(Alpine) {
|
||||
Alpine.directive("intersect", Alpine.skipDuringClone((el, { value, expression, modifiers }, { evaluateLater, cleanup }) => {
|
||||
let evaluate = evaluateLater(expression);
|
||||
let options = {
|
||||
rootMargin: getRootMargin(modifiers),
|
||||
threshold: getThreshold(modifiers)
|
||||
};
|
||||
let observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.isIntersecting === (value === "leave"))
|
||||
return;
|
||||
evaluate();
|
||||
modifiers.includes("once") && observer.disconnect();
|
||||
});
|
||||
}, options);
|
||||
observer.observe(el);
|
||||
cleanup(() => {
|
||||
observer.disconnect();
|
||||
});
|
||||
}));
|
||||
}
|
||||
function getThreshold(modifiers) {
|
||||
if (modifiers.includes("full"))
|
||||
return 0.99;
|
||||
if (modifiers.includes("half"))
|
||||
return 0.5;
|
||||
if (!modifiers.includes("threshold"))
|
||||
return 0;
|
||||
let threshold = modifiers[modifiers.indexOf("threshold") + 1];
|
||||
if (threshold === "100")
|
||||
return 1;
|
||||
if (threshold === "0")
|
||||
return 0;
|
||||
return Number(`.${threshold}`);
|
||||
}
|
||||
function getLengthValue(rawValue) {
|
||||
let match = rawValue.match(/^(-?[0-9]+)(px|%)?$/);
|
||||
return match ? match[1] + (match[2] || "px") : void 0;
|
||||
}
|
||||
function getRootMargin(modifiers) {
|
||||
const key = "margin";
|
||||
const fallback = "0px 0px 0px 0px";
|
||||
const index = modifiers.indexOf(key);
|
||||
if (index === -1)
|
||||
return fallback;
|
||||
let values = [];
|
||||
for (let i = 1; i < 5; i++) {
|
||||
values.push(getLengthValue(modifiers[index + i] || ""));
|
||||
}
|
||||
values = values.filter((v) => v !== void 0);
|
||||
return values.length ? values.join(" ").trim() : fallback;
|
||||
}
|
||||
|
||||
// packages/intersect/builds/module.js
|
||||
var module_default = src_default;
|
||||
export {
|
||||
module_default as default,
|
||||
src_default as intersect
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@alpinejs/intersect",
|
||||
"version": "3.13.8",
|
||||
"description": "Trigger JavaScript when an element enters the viewport",
|
||||
"homepage": "https://alpinejs.dev/plugins/intersect",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/alpinejs/alpine.git",
|
||||
"directory": "packages/intersect"
|
||||
},
|
||||
"author": "Caleb Porzio",
|
||||
"license": "MIT",
|
||||
"main": "dist/module.cjs.js",
|
||||
"module": "dist/module.esm.js",
|
||||
"unpkg": "dist/cdn.min.js",
|
||||
"dependencies": {}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
export default function (Alpine) {
|
||||
Alpine.directive('intersect', Alpine.skipDuringClone((el, { value, expression, modifiers }, { evaluateLater, cleanup }) => {
|
||||
let evaluate = evaluateLater(expression)
|
||||
|
||||
let options = {
|
||||
rootMargin: getRootMargin(modifiers),
|
||||
threshold: getThreshold(modifiers),
|
||||
}
|
||||
|
||||
let observer = new IntersectionObserver(entries => {
|
||||
entries.forEach(entry => {
|
||||
// Ignore entry if intersecting in leave mode, or not intersecting in enter mode
|
||||
if (entry.isIntersecting === (value === 'leave')) return
|
||||
|
||||
evaluate()
|
||||
|
||||
modifiers.includes('once') && observer.disconnect()
|
||||
})
|
||||
}, options)
|
||||
|
||||
observer.observe(el)
|
||||
|
||||
cleanup(() => {
|
||||
observer.disconnect()
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
function getThreshold(modifiers) {
|
||||
if (modifiers.includes('full')) return 0.99
|
||||
if (modifiers.includes('half')) return 0.5
|
||||
if (! modifiers.includes('threshold')) return 0
|
||||
|
||||
let threshold = modifiers[modifiers.indexOf('threshold') + 1]
|
||||
|
||||
if (threshold === '100') return 1
|
||||
if (threshold === '0') return 0
|
||||
|
||||
return Number(`.${threshold}`)
|
||||
}
|
||||
|
||||
export function getLengthValue(rawValue) {
|
||||
// Supported: -10px, -20 (implied px), 30 (implied px), 40px, 50%
|
||||
let match = rawValue.match(/^(-?[0-9]+)(px|%)?$/)
|
||||
return match ? match[1] + (match[2] || 'px') : undefined
|
||||
}
|
||||
|
||||
export function getRootMargin(modifiers) {
|
||||
const key = 'margin'
|
||||
const fallback = '0px 0px 0px 0px'
|
||||
const index = modifiers.indexOf(key)
|
||||
|
||||
// If the modifier isn't present, use the default.
|
||||
if (index === -1) return fallback
|
||||
|
||||
// Grab the 4 subsequent length values after it: x-intersect.margin.300px.0.50%.0
|
||||
let values = []
|
||||
for (let i = 1; i < 5; i++) {
|
||||
values.push(getLengthValue(modifiers[index + i] || ''))
|
||||
}
|
||||
|
||||
// Filter out undefined values (not a valid length)
|
||||
values = values.filter((v) => v !== undefined)
|
||||
|
||||
return values.length ? values.join(' ').trim() : fallback
|
||||
}
|
||||
Reference in New Issue
Block a user