use-flex-wrap
Version:
<div align='center'> <a> <img width='200' src="logo.jpeg" alt='logo'> </a> </div>
30 lines (29 loc) • 741 B
JavaScript
const u = (e) => {
const s = getComputedStyle(e).flexDirection === "row", t = e.clientHeight, r = Array.from(e.children).map(
(c) => s ? c.offsetTop : c.offsetLeft
), o = Array.from(new Set(r)), i = o.length, n = o.length > 1 || e.scrollHeight > t;
return {
isWrap: n,
wrapStage: n ? i - 1 : 0
};
}, a = (e, s) => {
const t = new ResizeObserver(s), r = new MutationObserver(s);
return t.observe(e), r.observe(e, { childList: !0, subtree: !0 }), {
disconnect: () => {
t.disconnect(), r.disconnect();
}
};
}, f = (e, s) => {
let t;
return (...r) => {
t && clearTimeout(t), t = setTimeout(() => e(...r), s);
};
}, b = {
debounceTime: 300
};
export {
f as a,
a as c,
u as d,
b as o
};