@zakisheriff/liquid-glass 0.3.13 → 0.3.14

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.mjs CHANGED
@@ -626,7 +626,7 @@ function container() {
626
626
  function canRefractBackdrop() {
627
627
  if (typeof navigator === "undefined") return false;
628
628
  const ua = navigator.userAgent;
629
- return /Chrom(e|ium)\/|Edg\//.test(ua) && !/CriOS|FxiOS|EdgiOS/.test(ua);
629
+ return /Chrom(e|ium)\/|Edg\//.test(ua) && !/CriOS|FxiOS|EdgiOS|Android/.test(ua);
630
630
  }
631
631
  function bevelProfile(bezel, thickness, ior) {
632
632
  const N = 256;
@@ -1702,6 +1702,8 @@ import { useRef as useRef7 } from "react";
1702
1702
  // src/engine/lensTrack.ts
1703
1703
  import { useEffect as useEffect5, useRef as useRef6 } from "react";
1704
1704
  var FOLLOW2 = springFrom(0.2, 0.82);
1705
+ var PULL_REACH = 0.08;
1706
+ var PULL_GIVE = 0.15;
1705
1707
  function useLensTrack(refs, options) {
1706
1708
  const latest = useRef6(options);
1707
1709
  latest.current = options;
@@ -1774,15 +1776,18 @@ function useLensTrack(refs, options) {
1774
1776
  if (!W || !H) return;
1775
1777
  const kx = (slot + (W - slot) * lift2) / W * (1 + squash);
1776
1778
  const ky = (height + (H - height) * lift2) / H * (1 - squash * 0.6);
1777
- const grow = 1 + latest.current.swell / Math.max(bar.offsetWidth, 1) * swell2;
1778
1779
  const pull2 = state.pull;
1779
- const ey = Math.abs(pull2) / Math.max(bar.offsetHeight, 1);
1780
+ const h = Math.max(bar.offsetHeight, 1);
1781
+ const reach = Math.abs(pull2);
1782
+ const taken = clamp(reach / (h * PULL_REACH), 0, 1);
1783
+ const grow = 1 + latest.current.swell / Math.max(bar.offsetWidth, 1) * swell2 * (1 - taken * 0.85);
1784
+ const lean = Math.sign(pull2) * (reach / 2 + h * 0.03 * taken);
1780
1785
  const transform = `translateX(${x2}px) scale(${kx}, ${ky})`;
1781
1786
  lens.style.transform = transform;
1782
1787
  select.style.transform = `translateX(${x2}px)`;
1783
1788
  lens.style.opacity = String(clamp(lift2 * 4, 0, 1));
1784
- shell.style.scale = `${grow * (1 - ey * 0.15)} ${grow * (1 + ey * 0.5)}`;
1785
- shell.style.translate = `0px ${pull2 / 2}px`;
1789
+ shell.style.scale = `${grow * (1 - taken * 0.04)} ${grow + reach / h}`;
1790
+ shell.style.translate = `0px ${lean}px`;
1786
1791
  lens.style.setProperty("--lg-lift", String(clamp(lift2, 0, 1)));
1787
1792
  bar.style.setProperty("--lg-lift", String(clamp(lift2, 0, 1)));
1788
1793
  for (const glyph of glyphs) {
@@ -1857,8 +1862,10 @@ function useLensTrack(refs, options) {
1857
1862
  paint();
1858
1863
  });
1859
1864
  const pull = (dy) => {
1865
+ if (!latest.current.pull) return;
1866
+ const toLayout = gesture ? bar.offsetHeight / Math.max(1, gesture.box.height) : 1;
1860
1867
  pullY.tune(FOLLOW2);
1861
- pullY.set(rubberband(dy, Math.min(10, bar.offsetHeight * 0.2), 0.5));
1868
+ pullY.set(rubberband(dy * toLayout, bar.offsetHeight * PULL_REACH, PULL_GIVE));
1862
1869
  };
1863
1870
  const letGo = () => {
1864
1871
  pullY.tune(SPRINGS.release);
@@ -2098,7 +2105,9 @@ function LensTrack({
2098
2105
  spread: tabbar ? 0.3 : 0.16,
2099
2106
  contentZoom: zoom,
2100
2107
  copied: true,
2101
- swell: tabbar ? 8 : 14
2108
+ swell: tabbar ? 12 : 16,
2109
+ // The tab bar holds its place; only the segmented control gives.
2110
+ pull: !tabbar
2102
2111
  }
2103
2112
  );
2104
2113
  return /* @__PURE__ */ jsxs5(