Add supporting themes required for Lotusdocs
This commit is contained in:
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
|
||||
});
|
||||
Reference in New Issue
Block a user