UNPKG

bootstrap-vue-next

Version:

BootstrapVueNext is an early and lovely component library for Vue 3 & Nuxt 3 based on Bootstrap 5 and Typescript.

45 lines (44 loc) 1.3 kB
function findProvides(binding, vnode) { const provides = (vnode.ctx === binding.instance.$ ? findComponentParent(vnode, binding.instance.$)?.provides : vnode.ctx?.provides) ?? binding.instance.$.provides; return provides; } function findComponentParent(vnode, root) { const stack = /* @__PURE__ */ new Set(); const walk = (children) => { for (const child of children) { if (!child) continue; if (child === vnode || child.el && vnode.el && child.el === vnode.el) { return true; } stack.add(child); let result2; if (child.suspense) { result2 = walk([child.ssContent]); } else if (Array.isArray(child.children)) { result2 = walk(child.children); } else if (child.component?.vnode) { result2 = walk([child.component?.subTree]); } if (result2) { return result2; } stack.delete(child); } return false; }; if (!walk([root.subTree])) { console.error("Could not find original vnode, will not inherit provides"); return root; } const result = Array.from(stack).reverse(); for (const child of result) { if (child.component) { return child.component; } } return root; } export { findProvides as f }; //# sourceMappingURL=utils-DAHbMzJg.mjs.map