54 lines
1.6 KiB
JavaScript
54 lines
1.6 KiB
JavaScript
|
import {
|
||
|
SUPPORTS_INTERSECTION
|
||
|
} from "./chunk-I4KGD5X4.js";
|
||
|
|
||
|
// node_modules/vuetify/lib/directives/intersect/index.mjs
|
||
|
function mounted(el, binding) {
|
||
|
if (!SUPPORTS_INTERSECTION) return;
|
||
|
const modifiers = binding.modifiers || {};
|
||
|
const value = binding.value;
|
||
|
const {
|
||
|
handler,
|
||
|
options
|
||
|
} = typeof value === "object" ? value : {
|
||
|
handler: value,
|
||
|
options: {}
|
||
|
};
|
||
|
const observer = new IntersectionObserver(function() {
|
||
|
var _a;
|
||
|
let entries = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
||
|
let observer2 = arguments.length > 1 ? arguments[1] : void 0;
|
||
|
const _observe = (_a = el._observe) == null ? void 0 : _a[binding.instance.$.uid];
|
||
|
if (!_observe) return;
|
||
|
const isIntersecting = entries.some((entry) => entry.isIntersecting);
|
||
|
if (handler && (!modifiers.quiet || _observe.init) && (!modifiers.once || isIntersecting || _observe.init)) {
|
||
|
handler(isIntersecting, entries, observer2);
|
||
|
}
|
||
|
if (isIntersecting && modifiers.once) unmounted(el, binding);
|
||
|
else _observe.init = true;
|
||
|
}, options);
|
||
|
el._observe = Object(el._observe);
|
||
|
el._observe[binding.instance.$.uid] = {
|
||
|
init: false,
|
||
|
observer
|
||
|
};
|
||
|
observer.observe(el);
|
||
|
}
|
||
|
function unmounted(el, binding) {
|
||
|
var _a;
|
||
|
const observe = (_a = el._observe) == null ? void 0 : _a[binding.instance.$.uid];
|
||
|
if (!observe) return;
|
||
|
observe.observer.unobserve(el);
|
||
|
delete el._observe[binding.instance.$.uid];
|
||
|
}
|
||
|
var Intersect = {
|
||
|
mounted,
|
||
|
unmounted
|
||
|
};
|
||
|
var intersect_default = Intersect;
|
||
|
|
||
|
export {
|
||
|
intersect_default
|
||
|
};
|
||
|
//# sourceMappingURL=chunk-3JAGB4CS.js.map
|