UNPKG

@opensig/opendesign

Version:

26 lines (25 loc) 919 B
"use strict"; const vue = require("vue"); require("../_utils/is.js"); const useElementIntersection = require("../hooks/use-element-intersection.js"); require("../hooks/use-theme.js"); require("../_utils/global.js"); require("@vueuse/core"); const intersectionObserver = vue.defineComponent({ name: "OIntersectionObserver", emits: ["intersection"], setup(_props, { emit, slots }) { const { vIntersectionObserver } = useElementIntersection.useIntersectionObserverDirective({ listener: (entry) => { emit("intersection", entry.isIntersecting, entry); }, removeOnUnmounted: false }); return () => { var _a; const children = (_a = slots.default) == null ? void 0 : _a.call(slots); return children == null ? void 0 : children.map((item) => vue.withDirectives(vue.cloneVNode(item), [[vIntersectionObserver]])); }; } }); module.exports = intersectionObserver;