UNPKG

motion-plus-vue

Version:

Motion Plus Vue

43 lines (42 loc) 880 B
function u(s, a, n, r = !0) { const h = { insets: [], visibleLength: a }; if (s.length === 0) return h; const e = [s[0].start]; for (let g = 1; g < s.length; g++) { const { start: t, end: f } = s[g]; if (e[e.length - 1] + a < f) if (n !== null) if (t <= n) e.push(t); else { e.push(n); break; } else e.push(t); } if (r && n !== null && e.length > 1) { const g = e[e.length - 1], t = []; for (let l = 0; l < e.length - 1; l++) t.push(e[l + 1] - e[l]); const f = t.reduce((l, i) => l + i, 0) / t.length; if (n - g < f * 0.5) { const l = u( s, a * 0.75, n, !1 ); if (l.insets.length === e.length) return l; } } return { insets: e, visibleLength: a }; } export { u as calcPageInsets };