bootstrap-vue-next
Version:
BootstrapVueNext is an early and lovely component library for Vue 3 & Nuxt 3 based on Bootstrap 5 and Typescript.
40 lines (39 loc) • 1.21 kB
JavaScript
import { ref, computed, readonly } from "vue";
import { h as modalManagerPluginKey } from "../../../keys-DUCx0SNv.mjs";
const modalManagerPlugin = {
install(app) {
const stack = ref(/* @__PURE__ */ new Map());
const countStack = computed(() => stack.value.size);
const valuesStack = computed(() => [...stack.value.values()]);
const lastStack = computed(() => valuesStack.value[valuesStack.value.length - 1]);
const pushStack = (modal) => {
stack.value.set(modal.uid, modal);
};
const removeStack = (modal) => {
stack.value.delete(modal.uid);
};
const registry = ref(/* @__PURE__ */ new Map());
const pushRegistry = (modal) => {
registry.value.set(modal.uid, modal);
};
const removeRegistry = (modal) => {
registry.value.delete(modal.uid);
};
app.provide(modalManagerPluginKey, {
countStack,
lastStack,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
registry: readonly(registry),
stack: valuesStack,
pushStack,
removeStack,
pushRegistry,
removeRegistry
});
}
};
export {
modalManagerPlugin
};
//# sourceMappingURL=index.mjs.map