@s_and_a/arrow-ui 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3624,14 +3624,14 @@ var dr = (e) => e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && e
3624
3624
  }
3625
3625
  function d() {
3626
3626
  if (!n.scroll) return;
3627
- let e, t = Infinity;
3628
- for (let r of s.value) {
3629
- let i = document.getElementById(String(r.value));
3630
- if (!i) continue;
3631
- let a = Math.abs(i.getBoundingClientRect().top - n.scrollOffset);
3632
- a < t && (t = a, e = String(r.value));
3627
+ let e, t = -Infinity, r, a = Infinity;
3628
+ for (let i of s.value) {
3629
+ let o = document.getElementById(String(i.value));
3630
+ if (!o) continue;
3631
+ let s = o.getBoundingClientRect().top;
3632
+ s <= n.scrollOffset && s > t ? (t = s, e = String(i.value)) : s > n.scrollOffset && s < a && (a = s, r = String(i.value));
3633
3633
  }
3634
- i.value = e;
3634
+ i.value = e ?? r;
3635
3635
  }
3636
3636
  return se(() => {
3637
3637
  d(), document.addEventListener("scroll", d, !0);