motion-plus-vue
Version:
Motion Plus Vue
58 lines (57 loc) • 1.11 kB
JavaScript
function d(t, e, f, r, a) {
return {
sign: 1,
direction: a,
lengthProp: e,
viewportLengthProp: f,
paddingStartProp: r,
measureItem: (n) => ({
start: n[t],
end: n[t] + n[e]
}),
getCumulativeInset: (n) => {
let s = 0, o = n;
for (; o; )
s += o[t], o = o.offsetParent;
return s;
}
};
}
const g = d(
"offsetLeft",
"offsetWidth",
"innerWidth",
"paddingLeft",
"right"
), u = d(
"offsetTop",
"offsetHeight",
"innerHeight",
"paddingTop",
"bottom"
);
function i(t, e) {
return ((e == null ? void 0 : e.offsetWidth) ?? window.innerWidth) - (t.offsetLeft + t.offsetWidth);
}
const h = {
...g,
sign: -1,
direction: "left",
paddingStartProp: "paddingRight",
measureItem: (t, e) => {
const f = t.offsetWidth, r = i(t, e);
return { start: r, end: r + f };
},
getCumulativeInset: (t) => {
let e = 0, f = t;
for (; f; )
e += i(f, f.offsetParent), f = f.offsetParent;
return e;
}
};
function l(t, e) {
return t === "y" ? u : e === "ltr" ? g : h;
}
export {
l as getLayoutStrategy
};