@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.d.mts CHANGED
@@ -272,7 +272,12 @@ interface GlassShape {
272
272
  */
273
273
  copy?: boolean | 'refract';
274
274
  }
275
- /** Only Chromium runs SVG filters inside `backdrop-filter`. */
275
+ /**
276
+ * Only Chromium runs SVG filters inside `backdrop-filter`, and only desktop
277
+ * GPUs carry it: it re-runs over the live backdrop every frame, which holds
278
+ * even flagship Android phones near 30fps. Android takes the path iPhones do
279
+ * (lenses refract a live copy, resting glass keeps blur and rim).
280
+ */
276
281
  declare function canRefractBackdrop(): boolean;
277
282
  /**
278
283
  * Bakes refraction for `ref`'s current box (untransformed) and keeps it fresh
package/dist/index.d.ts CHANGED
@@ -272,7 +272,12 @@ interface GlassShape {
272
272
  */
273
273
  copy?: boolean | 'refract';
274
274
  }
275
- /** Only Chromium runs SVG filters inside `backdrop-filter`. */
275
+ /**
276
+ * Only Chromium runs SVG filters inside `backdrop-filter`, and only desktop
277
+ * GPUs carry it: it re-runs over the live backdrop every frame, which holds
278
+ * even flagship Android phones near 30fps. Android takes the path iPhones do
279
+ * (lenses refract a live copy, resting glass keeps blur and rim).
280
+ */
276
281
  declare function canRefractBackdrop(): boolean;
277
282
  /**
278
283
  * Bakes refraction for `ref`'s current box (untransformed) and keeps it fresh
package/dist/index.js CHANGED
@@ -680,7 +680,7 @@ function container() {
680
680
  function canRefractBackdrop() {
681
681
  if (typeof navigator === "undefined") return false;
682
682
  const ua = navigator.userAgent;
683
- return /Chrom(e|ium)\/|Edg\//.test(ua) && !/CriOS|FxiOS|EdgiOS/.test(ua);
683
+ return /Chrom(e|ium)\/|Edg\//.test(ua) && !/CriOS|FxiOS|EdgiOS|Android/.test(ua);
684
684
  }
685
685
  function bevelProfile(bezel, thickness, ior) {
686
686
  const N = 256;
@@ -1756,6 +1756,8 @@ var import_react9 = require("react");
1756
1756
  // src/engine/lensTrack.ts
1757
1757
  var import_react8 = require("react");
1758
1758
  var FOLLOW2 = springFrom(0.2, 0.82);
1759
+ var PULL_REACH = 0.08;
1760
+ var PULL_GIVE = 0.15;
1759
1761
  function useLensTrack(refs, options) {
1760
1762
  const latest = (0, import_react8.useRef)(options);
1761
1763
  latest.current = options;
@@ -1828,15 +1830,18 @@ function useLensTrack(refs, options) {
1828
1830
  if (!W || !H) return;
1829
1831
  const kx = (slot + (W - slot) * lift2) / W * (1 + squash);
1830
1832
  const ky = (height + (H - height) * lift2) / H * (1 - squash * 0.6);
1831
- const grow = 1 + latest.current.swell / Math.max(bar.offsetWidth, 1) * swell2;
1832
1833
  const pull2 = state.pull;
1833
- const ey = Math.abs(pull2) / Math.max(bar.offsetHeight, 1);
1834
+ const h = Math.max(bar.offsetHeight, 1);
1835
+ const reach = Math.abs(pull2);
1836
+ const taken = clamp(reach / (h * PULL_REACH), 0, 1);
1837
+ const grow = 1 + latest.current.swell / Math.max(bar.offsetWidth, 1) * swell2 * (1 - taken * 0.85);
1838
+ const lean = Math.sign(pull2) * (reach / 2 + h * 0.03 * taken);
1834
1839
  const transform = `translateX(${x2}px) scale(${kx}, ${ky})`;
1835
1840
  lens.style.transform = transform;
1836
1841
  select.style.transform = `translateX(${x2}px)`;
1837
1842
  lens.style.opacity = String(clamp(lift2 * 4, 0, 1));
1838
- shell.style.scale = `${grow * (1 - ey * 0.15)} ${grow * (1 + ey * 0.5)}`;
1839
- shell.style.translate = `0px ${pull2 / 2}px`;
1843
+ shell.style.scale = `${grow * (1 - taken * 0.04)} ${grow + reach / h}`;
1844
+ shell.style.translate = `0px ${lean}px`;
1840
1845
  lens.style.setProperty("--lg-lift", String(clamp(lift2, 0, 1)));
1841
1846
  bar.style.setProperty("--lg-lift", String(clamp(lift2, 0, 1)));
1842
1847
  for (const glyph of glyphs) {
@@ -1911,8 +1916,10 @@ function useLensTrack(refs, options) {
1911
1916
  paint();
1912
1917
  });
1913
1918
  const pull = (dy) => {
1919
+ if (!latest.current.pull) return;
1920
+ const toLayout = gesture ? bar.offsetHeight / Math.max(1, gesture.box.height) : 1;
1914
1921
  pullY.tune(FOLLOW2);
1915
- pullY.set(rubberband(dy, Math.min(10, bar.offsetHeight * 0.2), 0.5));
1922
+ pullY.set(rubberband(dy * toLayout, bar.offsetHeight * PULL_REACH, PULL_GIVE));
1916
1923
  };
1917
1924
  const letGo = () => {
1918
1925
  pullY.tune(SPRINGS.release);
@@ -2152,7 +2159,9 @@ function LensTrack({
2152
2159
  spread: tabbar ? 0.3 : 0.16,
2153
2160
  contentZoom: zoom,
2154
2161
  copied: true,
2155
- swell: tabbar ? 8 : 14
2162
+ swell: tabbar ? 12 : 16,
2163
+ // The tab bar holds its place; only the segmented control gives.
2164
+ pull: !tabbar
2156
2165
  }
2157
2166
  );
2158
2167
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(