npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lmquang/liquid-glass

v0.1.0

Published

Opt-in liquid glass surfaces with React, SVG refraction and standalone CSS fallbacks.

Readme

@lmquang/liquid-glass

Opt-in glass surfaces: standalone CSS fallbacks and a React hook for Canvas/SVG refraction. No Tailwind, shadcn, WebGL or UI component dependency.

Install

npm install @lmquang/liquid-glass
# or: bun add @lmquang/liquid-glass

Import the stylesheet once. The React entry requires React 19; React is a peer, not bundled. CSS and the /core entry do not require React.

import { useLiquidGlass } from '@lmquang/liquid-glass'
import '@lmquang/liquid-glass/styles.css'

export function RefreshButton() {
  const glass = useLiquidGlass<HTMLButtonElement>({
    model: 'snell',
    specularAboveTint: true,
  })
  return (
    <button ref={glass.ref} className={`${glass.className} refresh-button`}>
      {glass.layer}Refresh
    </button>
  )
}
.refresh-button {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: inherit;
  --glass-tint: rgb(255 255 255 / 0.8);
}

Keep the host transparent. Insert layer inside the semantic host; attach ref to its DOM node. Preserve the host's handlers, ARIA and focus styles. Compose an existing ref explicitly. Do not clip the host: only the decorative layer clips.

CSS-only use

@import '@lmquang/liquid-glass/styles.css';
<button class="liquid-glass refresh-button">
  <span class="liquid-glass-layer" aria-hidden="true"></span>
  Refresh
</button>

CSS alone provides tint, blur, a 1px rim and solid accessibility fallbacks. SVG refraction and the directional highlight need the JavaScript hook. This is not a Tailwind plugin or a pure-CSS Snell implementation.

Hook options

| Option | Default | Meaning | | --- | --- | --- | | mode | 'auto' | 'fallback' forces CSS-only rendering; it retains blur where allowed. | | model | 'rim' | 'rim', 'snell' or 'snell-strong'. | | specular | true | Enables the normal-based SVG highlight on Snell models. | | specularAboveTint | false | Places uniform tint before the Snell highlight rather than over it. |

The hook returns { ref, className, layer }. It renders fallback during SSR and while textures load. Browser APIs run only after mount. Public types include LiquidGlassOptions, GlassModel, GlassGeometry and GlassRadii.

Tint always covers the full surface, including the optical bezel. By default, tint attenuates both refraction and highlight. With specularAboveTint: true, 100% opaque tint hides the refracted backdrop but not the highlight. Turning specular off does not remove tint or displacement. Tint, specular and composition changes reuse textures.

rim uses a sine approximation without SVG lighting. snell uses a convex squircle profile, one air-to-glass refraction and a separate directional highlight. snell-strong doubles render displacement and highlight gain, not the physical model. No CSS gradient or inset shading replaces that highlight.

CSS tokens

Set these on a host or ancestor. Package defaults do not override inherited values.

| Token | Default | Use | | --- | --- | --- | | --glass-tint | rgb(255 255 255 / 0.48) | Full-surface tint, including alpha. | | --glass-tint-override | Unset | Optional shared override; takes priority over tint. | | --glass-rim | rgb(255 255 255 / 0.7) | 1px inset rim color. | | --glass-solid | white | Solid fallback; choose a color that suits host text. | | --glass-blur | 1px | CSS fallback blur. |

No global reset, dark-mode selector, typography, padding or host radius is supplied. Set dark-theme tokens in your app. Reduced transparency and forced colors ignore tint overrides and disable blur/refraction; forced colors use Canvas/CanvasText.

Tailwind and existing components

@import 'tailwindcss';
@import '@lmquang/liquid-glass/styles.css';

Styles use native @layer components. Tailwind utilities such as sticky, absolute, padding and radius can override host defaults. Plain unlayered app rules can also override them. No Tailwind source scanning of this package is needed.

The hook does not replace your Button/Popover. With asChild, attach the ref and insert the layer inside the actual anchor/button. SVG definitions retain a size-0 compatibility marker for icon-sizing selectors; package CSS supplies their zero dimensions without Tailwind.

Core entry

import { createGlassTextures } from '@lmquang/liquid-glass/core'

const textures = createGlassTextures({ width: 320, height: 44, radius: 9999 }, 'snell')
// null for invalid/oversized geometry; otherwise displacement/highlight RGBA and SVG scale.

Also exports createGlassMap (rim compatibility wrapper), observeGlassGeometry, supportsGlassRefraction, GLASS_SCALE, GLASS_PIXEL_BUDGET and geometry/model types. Geometry observation needs a browser; texture generation itself does not.

Limits and browser support

  • SVG activates only for eligible non-iOS Chromium, CSS URL-filter syntax support and successfully loaded textures. This gate is not proof of renderer correctness.
  • Safari/iOS and other browsers keep CSS fallback, not native refraction or the SVG highlight. Real-device Safari refraction is not claimed.
  • No backdrop-filter support means solid fallback. Reduced transparency/forced colors disable texture work.
  • Four circular corner radii with CSS overlap normalization. Use a large pixel radius for capsules; 50% on a wide host is elliptical and falls back.
  • One map pixel per CSS pixel; at most 262,144 pixels per surface and 4,096 per dimension. Hidden, invalid or oversized surfaces fall back.
  • Resize and host class/style changes coalesce into one animation frame. Unchanged geometry does not rebuild textures. Ancestor-only styles, stylesheet/pseudo-class changes and radius animations do not trigger a refresh.
  • No transformed hosts, arbitrary masks, nested glass or continuous animation. Use small controls/toolbars, not dense content panels. Ancestor opacity/filter/mask can change the backdrop root.
  • Optional Canvas/image failures retain CSS fallback. No global map cache, telemetry or account/data access.

Development and release

bun install --frozen-lockfile
bun run typecheck
bun run test
bun run build
npm pack --dry-run
npm pack

examples/basic is a plain React/Vite consumer. After the release is available, install its dependencies and run bun run dev there. Before publishing, test a temporary copy against the packed tarball instead of aliasing package source.

Release manually: bump version, run checks, inspect the packed file list, run npm publish <artifact.tgz> --dry-run --access public, then publish that same artifact with --access public --registry=https://registry.npmjs.org. Login/2FA and scope permissions are required. Never include credentials or replace an existing version. Consumers should update their version and lockfile together. No automatic publishing is configured.

Sources and license

Inspired by Liquid Glass in the Browser and SVG displacement. The article omits complete ray-intersection/lighting code; this is an approximation, not an exact reproduction or Fresnel simulation.

UNLICENSED. Public registry access does not grant an open-source license.