ant-design-x-vue
Version:
Craft AI-driven interfaces effortlessly
87 lines (86 loc) • 2.59 kB
JavaScript
const i = /margin|padding|width|height|max|min|offset/, l = {
left: !0,
top: !0
}, r = {
cssFloat: 1,
styleFloat: 1,
float: 1
};
function u(e) {
return e.nodeType === 1 ? e.ownerDocument.defaultView.getComputedStyle(e, null) : {};
}
function s(e, t, o) {
if (t = t.toLowerCase(), o === "auto") {
if (t === "height")
return e.offsetHeight;
if (t === "width")
return e.offsetWidth;
}
return t in l || (l[t] = i.test(t)), l[t] ? parseFloat(o) || 0 : o;
}
function f(e, t) {
const o = arguments.length, n = u(e);
return t = r[t] ? "cssFloat" in e.style ? "cssFloat" : "styleFloat" : t, o === 1 ? n : s(e, t, n[t] || e.style[t]);
}
function d(e, t, o) {
const n = arguments.length;
if (t = r[t] ? "cssFloat" in e.style ? "cssFloat" : "styleFloat" : t, n === 3)
return typeof o == "number" && i.test(t) && (o = `${o}px`), e.style[t] = o, o;
for (const c in t)
t.hasOwnProperty(c) && d(e, c, t[c]);
return u(e);
}
function m(e) {
return e === document.body ? document.documentElement.clientWidth : e.offsetWidth;
}
function h(e) {
return e === document.body ? window.innerHeight || document.documentElement.clientHeight : e.offsetHeight;
}
function g() {
const e = Math.max(document.documentElement.scrollWidth, document.body.scrollWidth), t = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight);
return {
width: e,
height: t
};
}
function y() {
const e = document.documentElement.clientWidth, t = window.innerHeight || document.documentElement.clientHeight;
return {
width: e,
height: t
};
}
function p() {
return {
scrollLeft: Math.max(document.documentElement.scrollLeft, document.body.scrollLeft),
scrollTop: Math.max(document.documentElement.scrollTop, document.body.scrollTop)
};
}
function w(e) {
const t = e.getBoundingClientRect(), o = document.documentElement;
return {
left: t.left + (window.scrollX || o.scrollLeft) - (o.clientLeft || document.body.clientLeft || 0),
top: t.top + (window.scrollY || o.scrollTop) - (o.clientTop || document.body.clientTop || 0)
};
}
function a(e) {
return Array.prototype.slice.apply(e).map((o) => `${o}: ${e.getPropertyValue(o)};`).join("");
}
function b(e) {
return Object.keys(e).reduce((t, o) => {
const n = e[o];
return typeof n > "u" || n === null || (t += `${o}: ${e[o]};`), t;
}, "");
}
export {
f as get,
y as getClientSize,
g as getDocSize,
w as getOffset,
h as getOuterHeight,
m as getOuterWidth,
p as getScroll,
d as set,
b as styleObjectToString,
a as styleToString
};