bootstrap-vue-next
Version:
Seamless integration of Vue 3, Bootstrap 5, and TypeScript for modern, type-safe UI development
35 lines (34 loc) • 1.58 kB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_dom = require("../../../dom-Bs6DzM72.js");
const require_object = require("../../../object-BN7QwMcz.js");
const require_src_composables_useScrollspy_index = require("../../composables/useScrollspy/index.umd.js");
const require_utils = require("../../../utils-CaC78Zdk.js");
require("vue");
//#region src/directives/BScrollspy/index.ts
var bind = (el, binding) => {
if (require_dom.getSafeDocument() === null) return;
const uid = require_utils.getDirectiveUid(binding);
const elWithScrollspy = el;
elWithScrollspy.$__scrollspy = elWithScrollspy.$__scrollspy ?? Object.create(null);
const existingInstance = elWithScrollspy.$__scrollspy[uid];
if (existingInstance) existingInstance.cleanup();
const { arg, value } = binding;
const isObject = typeof value === "object" && value !== null;
const content = arg ? arg : typeof value === "string" ? value : isObject ? value.content || value.element : null;
elWithScrollspy.$__scrollspy[uid] = require_src_composables_useScrollspy_index.useScrollspy(content, el, isObject ? require_object.omit(value, ["content", "element"]) : {});
};
var vBScrollspy = {
mounted: bind,
updated: bind,
beforeUnmount(el, binding) {
const uid = require_utils.getDirectiveUid(binding);
const elWithScrollspy = el;
const instance = elWithScrollspy.$__scrollspy?.[uid];
if (!instance) return;
instance.cleanup();
delete elWithScrollspy.$__scrollspy[uid];
}
};
//#endregion
exports.vBScrollspy = vBScrollspy;
//# sourceMappingURL=index.umd.js.map