zsbqb-static 0.1.9 → 0.1.10

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/css/app.css CHANGED
@@ -853,8 +853,11 @@ th { color: var(--muted); font-weight: 600; font-size: 13px; background: var(--b
853
853
  width: 28px;
854
854
  flex: 1 1 auto;
855
855
  min-height: 1em;
856
+ margin: 0;
856
857
  padding: 0;
858
+ border: 0;
857
859
  border-radius: 5px;
860
+ background: transparent;
858
861
  color: var(--muted);
859
862
  font-size: clamp(8px, calc((var(--alpha-rail-fit, 70svh) - 20px) / 36), 13px);
860
863
  font-weight: 600;
@@ -862,6 +865,9 @@ th { color: var(--muted); font-weight: 600; font-size: 13px; background: var(--b
862
865
  font-variant-numeric: tabular-nums;
863
866
  line-height: 1;
864
867
  letter-spacing: 0;
868
+ appearance: none;
869
+ -webkit-appearance: none;
870
+ cursor: pointer;
865
871
  }
866
872
  .alpha-rail__item:hover,
867
873
  .alpha-rail__item.is-scrub {
package/js/app.js CHANGED
@@ -1639,14 +1639,24 @@ function bindAlphaRail() {
1639
1639
  items.forEach((el) => el.classList.remove("is-scrub"));
1640
1640
  }
1641
1641
 
1642
+ function currentLetter() {
1643
+ const on = items.find((el) => el.classList.contains("is-on"));
1644
+ return letterOf(on);
1645
+ }
1646
+
1642
1647
  function goTo(item) {
1643
1648
  if (!item || navigating) return;
1644
1649
  const label = letterOf(item);
1650
+ if (!label) return;
1651
+ const qEl = document.querySelector("[data-search-input]");
1652
+ const qDisplay = (qEl && qEl.value ? qEl.value : "").trim();
1653
+ if (!qDisplay && label.toLowerCase() === currentLetter().toLowerCase()) return;
1645
1654
  if (typeof window.__setQueryLetterFilter === "function") {
1646
1655
  window.__setQueryLetterFilter(label);
1647
1656
  return;
1648
1657
  }
1649
- const next = item.href;
1658
+ if (!qDisplay && item.classList.contains("is-on")) return;
1659
+ const next = item.getAttribute("data-href") || item.href;
1650
1660
  if (!next || next === window.location.href) return;
1651
1661
  navigating = true;
1652
1662
  window.location.assign(next);
@@ -1696,14 +1706,19 @@ function bindAlphaRail() {
1696
1706
  rail.addEventListener("pointermove", onPointerMove);
1697
1707
  rail.addEventListener("pointerup", onPointerUp);
1698
1708
  rail.addEventListener("pointercancel", onPointerCancel);
1699
-
1700
- items.forEach((item) => {
1701
- item.addEventListener("click", (event) => {
1709
+ rail.addEventListener(
1710
+ "click",
1711
+ (event) => {
1702
1712
  event.preventDefault();
1713
+ event.stopPropagation();
1703
1714
  if (pointerHandled) return;
1704
- goTo(item);
1705
- });
1706
- });
1715
+ const raw = event.target;
1716
+ const el = raw && raw.nodeType === 1 ? raw : raw && raw.parentElement;
1717
+ const item = el && el.closest ? el.closest("[data-alpha-item]") : null;
1718
+ if (item && rail.contains(item)) goTo(item);
1719
+ },
1720
+ true
1721
+ );
1707
1722
 
1708
1723
  window.__fitQueryAlphaRail = fitRail;
1709
1724
  fitRail();