bootstrap-vue-next
Version:
BootstrapVueNext is an early and lovely component library for Vue 3 & Nuxt 3 based on Bootstrap 5 and Typescript.
3 lines (2 loc) • 1.48 kB
JavaScript
const e=require("./index-DiURjA3G.js"),t=require("vue"),o=require("./keys-W3DrYQSP.js"),n=require("./index-BjjsoN-a.js"),l="modal-open",s=()=>{const s=t.inject(o.modalManagerPluginKey),u=e.getSSRHandler("updateHTMLAttrs",((t,o,n)=>{const s="string"==typeof t?null==window?void 0:window.document.querySelector(t):e.unrefElement(t);s&&("class"===o?s.classList.toggle(l,n===l):s.setAttribute(o,n))}));return n.tryOnScopeDispose((()=>{u("body","class","")})),t.watch((()=>null==s?void 0:s.countStack.value),(e=>{void 0!==e&&u("body","class",e>0?l:"")})),{...s,dispose:e=>{null==s||s.removeStack(e),null==s||s.removeRegistry(e)}}};exports.useModalManager=(e,o)=>{const{pushRegistry:l,pushStack:u,removeStack:r,stack:a,dispose:i,countStack:d}=s(),c=t.getCurrentInstance();if(!c||"BModal"!==c.type.__name)throw new Error("useModalManager must only use in BModal component");null==l||l(c),n.tryOnScopeDispose((()=>{i(c)}));const p=(e,t)=>{e?null==u||u(c):t&&!e&&(null==r||r(c))};return p(o,o),t.watch(e,p),{activePosition:t.computed((()=>null==a?void 0:a.value.findIndex((e=>{var o,n;return t.toValue(null==(o=e.exposed)?void 0:o.id)===t.toValue(null==(n=c.exposed)?void 0:n.id)})))),activeModalCount:d,stackWithoutSelf:t.computed((()=>(null==a?void 0:a.value.filter((e=>{var o,n;return t.toValue(null==(o=e.exposed)?void 0:o.id)!==t.toValue(null==(n=c.exposed)?void 0:n.id)})))??[]))}},exports.useSharedModalStack=s;
//# sourceMappingURL=useModalManager-s_gKy0a-.js.map
;