UNPKG

bootstrap-vue-next

Version:

Seamless integration of Vue 3, Bootstrap 5, and TypeScript for modern, type-safe UI development

68 lines (67 loc) 2.55 kB
import { s as unrefElement } from "./dist-B10a-gZ8.mjs"; import { computed, getCurrentInstance, onUpdated, ref, triggerRef } from "vue"; //#region ../../node_modules/.pnpm/reka-ui@2.9.2_vue@3.5.31_typescript@5.9.3_/node_modules/reka-ui/dist/shared/getActiveElement.js function getActiveElement() { let activeElement = document.activeElement; if (activeElement == null) return null; while (activeElement != null && activeElement.shadowRoot != null && activeElement.shadowRoot.activeElement != null) activeElement = activeElement.shadowRoot.activeElement; return activeElement; } //#endregion //#region ../../node_modules/.pnpm/reka-ui@2.9.2_vue@3.5.31_typescript@5.9.3_/node_modules/reka-ui/dist/shared/useForwardExpose.js function useForwardExpose() { const instance = getCurrentInstance(); const currentRef = ref(); const currentElement = computed(() => resolveCurrentElement()); onUpdated(() => { if (currentElement.value !== resolveCurrentElement()) triggerRef(currentRef); }); function resolveCurrentElement() { return currentRef.value && "$el" in currentRef.value && ["#text", "#comment"].includes(currentRef.value.$el.nodeName) ? currentRef.value.$el.nextElementSibling : unrefElement(currentRef); } const localExpose = Object.assign({}, instance.exposed); const ret = {}; for (const key in instance.props) Object.defineProperty(ret, key, { enumerable: true, configurable: true, get: () => instance.props[key] }); if (Object.keys(localExpose).length > 0) for (const key in localExpose) Object.defineProperty(ret, key, { enumerable: true, configurable: true, get: () => localExpose[key] }); Object.defineProperty(ret, "$el", { enumerable: true, configurable: true, get: () => instance.vnode.el }); instance.exposed = ret; function forwardRef(ref$1) { currentRef.value = ref$1; if (!ref$1) return; Object.defineProperty(ret, "$el", { enumerable: true, configurable: true, get: () => ref$1 instanceof Element ? ref$1 : ref$1.$el }); if (!(ref$1 instanceof Element) && !Object.prototype.hasOwnProperty.call(ref$1, "$el")) { const childExposed = ref$1.$.exposed; const merged = Object.assign({}, ret); for (const key in childExposed) Object.defineProperty(merged, key, { enumerable: true, configurable: true, get: () => childExposed[key] }); instance.exposed = merged; } } return { forwardRef, currentRef, currentElement }; } //#endregion export { getActiveElement as n, useForwardExpose as t }; //# sourceMappingURL=useForwardExpose-4OUimdPL.mjs.map