UNPKG

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.44 kB
"use strict";const e=require("./index-CnY1um_J.js"),t=require("vue"),o=require("./keys-dS8HZUdm.js"),n=require("./index-BInTFWT4.js"),s="modal-open",l=()=>{const l=t.inject(o.modalManagerPluginKey),r=e.getSSRHandler("updateHTMLAttrs",((t,o,n)=>{const l="string"==typeof t?null==window?void 0:window.document.querySelector(t):e.unrefElement(t);l&&("class"===o?l.classList.toggle(s,n===s):l.setAttribute(o,n))}));return n.tryOnScopeDispose((()=>{r("body","class","")})),t.watch((()=>null==l?void 0:l.countStack.value),(e=>{void 0!==e&&r("body","class",e>0?s:"")})),{...l,dispose:e=>{null==l||l.removeStack(e),null==l||l.removeRegistry(e)}}};exports.useModalManager=(e,o)=>{const{pushRegistry:s,pushStack:r,removeStack:u,stack:i,dispose:d,countStack:a}=l(),c=t.getCurrentInstance();if(!c||"BModal"!==c.type.__name)throw new Error("useModalManager must only use in BModal component");null==s||s(c),n.tryOnScopeDispose((()=>{d(c)}));const p=(e,t)=>{e?null==r||r(c):t&&!e&&(null==u||u(c))};return p(o,o),t.watch(e,p),{activePosition:t.computed((()=>null==i?void 0:i.value.findIndex((e=>{var t,o;return(null==(t=e.exposed)?void 0:t.id)===(null==(o=c.exposed)?void 0:o.id)})))),activeModalCount:a,stackWithoutSelf:t.computed((()=>(null==i?void 0:i.value.filter((e=>{var t,o;return(null==(t=e.exposed)?void 0:t.id)!==(null==(o=c.exposed)?void 0:o.id)})))??[]))}},exports.useSharedModalStack=l; //# sourceMappingURL=useModalManager-CBUQ1lYf.js.map