bootstrap-vue-next
Version:
BootstrapVueNext is an early and lovely component library for Vue 3 & Nuxt 3 based on Bootstrap 5 and Typescript.
37 lines (36 loc) • 1.17 kB
JavaScript
const getActiveElement = (excludes = []) => {
const { activeElement } = document;
return activeElement && !(excludes == null ? void 0 : excludes.some((el) => el === activeElement)) ? activeElement : null;
};
const attemptFocus = (el, options = {}) => {
const isActiveElement = (el2) => el2 === getActiveElement();
try {
el.focus(options);
} catch (e) {
console.error(e);
}
return isActiveElement(el);
};
const isEmptySlot = (el) => ((el == null ? void 0 : el()) ?? []).length === 0;
const isVisible = (el) => {
if (el.getAttribute("display") === "none") {
return false;
}
const bcr = el.getBoundingClientRect();
return !!(bcr && bcr.height > 0 && bcr.width > 0);
};
const sortSlotElementsByPosition = (a, b) => {
if (typeof Node === "undefined" || !Node || !a || !b) return 0;
const position = a.compareDocumentPosition(b);
if (position & Node.DOCUMENT_POSITION_FOLLOWING) return -1;
if (position & Node.DOCUMENT_POSITION_PRECEDING) return 1;
return 0;
};
export {
isVisible as a,
attemptFocus as b,
getActiveElement as g,
isEmptySlot as i,
sortSlotElementsByPosition as s
};
//# sourceMappingURL=dom-BK2w00Ec.mjs.map