bootstrap-vue-next
Version:
Seamless integration of Vue 3, Bootstrap 5, and TypeScript for modern, type-safe UI development
62 lines (61 loc) • 2.19 kB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../../chunk-CoQrYLCe.js");
const require_keys = require("../../../keys-durSVUrO.js");
const require_src_composables_useRegistry_index = require("../../composables/useRegistry/index.umd.js");
let vue = require("vue");
//#region src/plugins/registry/index.ts
var registryPlugin = { install(app) {
const { register, values } = require_src_composables_useRegistry_index._newShowHideRegistry();
app.provide(require_keys.showHideRegistryKey, {
register,
values
});
const items = (0, vue.ref)({ [require_keys.breadcrumbGlobalIndexKey]: [] });
const reset = (key = require_keys.breadcrumbGlobalIndexKey) => {
items.value[key] = [];
};
app.provide(require_keys.breadcrumbRegistryKey, {
items,
reset
});
/**
* A collection of all currently active modals
*
* It was made into a map so that if a modal is ever added into the stack twice, it will not be duplicated
* (if modelValue is true when started, it gets added in setup scope, then a watcher is triggered and it gets added again in the next tick)
* Didn't feel like fixing it in the modal component, so I just made it a map
*/
const stack = (0, vue.ref)(/* @__PURE__ */ new Map());
const countStack = (0, vue.computed)(() => stack.value.size);
const valuesStack = (0, vue.computed)(() => [...stack.value.values()]);
const lastStack = (0, vue.computed)(() => valuesStack.value[valuesStack.value.length - 1]);
const pushStack = (modal) => {
stack.value.set(modal.uid, modal);
};
const removeStack = (modal) => {
stack.value.delete(modal.uid);
};
/**
* A collection of all registered modals
*/
const registry = (0, vue.ref)(/* @__PURE__ */ new Map());
const pushRegistry = (modal) => {
registry.value.set(modal.uid, modal);
};
const removeRegistry = (modal) => {
registry.value.delete(modal.uid);
};
app.provide(require_keys.modalManagerKey, {
countStack,
lastStack,
registry: (0, vue.computed)(() => registry.value),
stack: valuesStack,
pushStack,
removeStack,
pushRegistry,
removeRegistry
});
} };
//#endregion
exports.registryPlugin = registryPlugin;
//# sourceMappingURL=index.umd.js.map