bootstrap-vue-next
Version:
Seamless integration of Vue 3, Bootstrap 5, and TypeScript for modern, type-safe UI development
48 lines (47 loc) • 1.6 kB
JavaScript
import { s as showHideRegistryKey, a as breadcrumbGlobalIndexKey, e as breadcrumbRegistryKey, m as modalManagerKey } from "../../../keys-BLeKMItg.mjs";
import { _newShowHideRegistry } from "../../composables/useRegistry/index.mjs";
import { ref, computed } from "vue";
const registryPlugin = {
install(app) {
const { register, values } = _newShowHideRegistry();
app.provide(showHideRegistryKey, { register, values });
const items = ref({
[breadcrumbGlobalIndexKey]: []
});
const reset = (key = breadcrumbGlobalIndexKey) => {
items.value[key] = [];
};
app.provide(breadcrumbRegistryKey, { items, reset });
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(modalManagerKey, {
countStack,
lastStack,
registry: computed(() => registry.value),
stack: valuesStack,
pushStack,
removeStack,
pushRegistry,
removeRegistry
});
}
};
export {
registryPlugin
};
//# sourceMappingURL=index.mjs.map