UNPKG

ant-design-x-vue

Version:

Craft AI-driven interfaces effortlessly

34 lines (33 loc) 1.08 kB
let d; function c(n) { if (typeof document > "u") return 0; if (n || d === void 0) { const e = document.createElement("div"); e.style.width = "100%", e.style.height = "200px"; const t = document.createElement("div"), i = t.style; i.position = "absolute", i.top = "0", i.left = "0", i.pointerEvents = "none", i.visibility = "hidden", i.width = "200px", i.height = "150px", i.overflow = "hidden", t.appendChild(e), document.body.appendChild(t); const l = e.offsetWidth; t.style.overflow = "scroll"; let o = e.offsetWidth; l === o && (o = t.clientWidth), document.body.removeChild(t), d = l - o; } return d; } function r(n) { const e = n.match(/^(.*)px$/), t = Number(e == null ? void 0 : e[1]); return Number.isNaN(t) ? c() : t; } function h(n) { if (typeof document > "u" || !n || !(n instanceof Element)) return { width: 0, height: 0 }; const { width: e, height: t } = getComputedStyle(n, "::-webkit-scrollbar"); return { width: r(e), height: r(t) }; } export { c as default, h as getTargetScrollBarSize };